Virtualenv and virtualenvwrapper are being used. It is now possible to switch between virtualenvs using the workon command.
me@mymachine:~$ workon env1 (env1)me@mymachine:~$ workon env2 (env2)me@mymachine:~$ workon env1 (env1)me@mymachine:~$
But, how do I exit all virtual machines and use my real machine again? The only way to exit now
me@mymachine:~$
But after exiting, the shell starts a new interface and the workspace cannot be restored.
Solution:
Normally, activating virtualenv will provide you with a shell function named:
$ deactivate
This brings things back to normal.
I just looked at the code of virtualenvwrapper again and yes it also supports deactivate
as a way to escape all virtualenvs
If you try to leave Anaconda environment, the process is slightly different: run the double-word command source deactivate, because they use a separate script to achieve deactivation.
bash-4.3$ deactivate pyenv-virtualenv: deactivate must be sourced. Run 'source deactivate' instead of 'deactivate' bash-4.3$ source deactivate pyenv-virtualenv: no virtualenv has been activated.
The above is the detailed content of How to leave/exit/deactivate Python's virtualenv. For more information, please follow other related articles on the PHP Chinese website!