pip3 install virtualenv pip3 install virtualenvwrapper # 1、创建目录用来存放虚拟环境 mkdir $HOME/.virtualenvs # 2、打开~/.bashrc文件,并添加如下: export WORKON_HOME=$HOME/.virtualenvs #存放虚拟环境的目录 export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/python3/bin/virtualenv #告诉virtualenvwrapper virtualenv在哪里 #export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 #告诉virtualenvwrapper python解释器在哪里,这里还可以参考 https://blog.csdn.net/TFATS/article/details/103882104 source /usr/local/python3/bin/virtualenvwrapper.sh # 3、运行 source ~/.bashrc
原文:https://www.cnblogs.com/ycg-blog/p/12219785.html