sudo pip install virtualenvpython
sudo pip install virtualenvwrapperubuntu
vi .bashrc(從home目錄進入bashrc文件)bash
export WORKON_HOME=$HOME.virtualenvsapp
source /usr/local/bin/.vitualenvwrapper.shpython2.7
source .bashrc 運行一下spa
mkvirtualenv -p python3 aa(建立名稱爲aa的虛擬環境,使用python3環境)3d
Running virtualenv with interpreter /usr/bin/python3.6
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 22, in
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
2)解決方式(缺乏distutils.spawn),安裝distutilsip
sudo apt-get install python-distutils
get
3)從新建立,建立成功
4.建立的環境位於home目錄.virtualenvs文件夾內
deactivate
workon 虛擬環境名稱
rmvitualenv 虛擬環境名稱