Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

安装虚拟环境

安装虚拟环境

pip2 install virtualenvwrapper
# **查找安装路径**   
which virtualenvwrapper.sh

virtual

编辑.bashrc

vim ~/.bashrc
# 增加以下环境变量
export WORKON_HOME=$HOME/.virtualenvs  
source /usr/local/bin/virtualenvwrapper.sh

立即生效

source .bashrc

查找python3路径

which python3

python3

创建虚拟环境

mkvirtualenv --python=/usr/bin/python3 name-env

workon name-env

切换/激活 虚拟环境

workon name-evn

cd ~/.virtualenvs/name-env/bin/

退出虚拟环境

deactivate name-env

删除虚拟环境

rmvirtualenv env-name