How to leave/exit/deactivate a Python virtualenv

前端 未结 13 1640
春和景丽
春和景丽 2020-11-27 08:42

I\'m using virtualenv and the virtualenvwrapper. I can switch between virtualenv\'s just fine using the workon command.

me@mymachine:~$ workon          


        
13条回答
  •  伪装坚强ぢ
    2020-11-27 09:29

    Usually, activating a virtualenv gives you a shell function named:

    $ deactivate
    

    which puts things back to normal.

    I have just looked specifically again at the code for virtualenvwrapper, and, yes, it too supports deactivate as the way to escape from all virtualenvs.

    If you are trying to leave an Anaconda environment, the command depends upon your version of conda. Recent versions (like 4.6) install a conda function directly in your shell, in which case you run:

    conda deactivate
    

    Older conda versions instead implement deactivation using a stand-alone script:

    source deactivate
    

提交回复
热议问题