How to leave/exit/deactivate a Python virtualenv

前端 未结 13 1638
春和景丽
春和景丽 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:27

    You can use virtualenvwrapper in order to ease the way you work with virtualenv.

    Installing virtualenvwrapper:

    pip install virtualenvwrapper
    

    If you are using a standard shell, open your ~/.bashrc or ~/.zshrc if you use Oh My Zsh. Add these two lines:

    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/local/bin/virtualenvwrapper.sh
    

    To activate an existing virtualenv, use command workon:

    $ workon myenv
    (myenv)$
    

    In order to deactivate your virtualenv:

    (myenv)$ deactivate
    

    Here is my tutorial, step by step on how to install virtualenv and virtualenvwrapper.

提交回复
热议问题