Ubuntu16.04
pip3 install --upgrade pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
virtualenvwrapper is an extended management package of virtualenv, which can integrate all virtual environments in one directory.
sudo mkdir ~/.envs
sudo vim ~/.bashrc
export WORKON_HOME=$HOME/.envs #All virtual environment storage directories
source /usr/local/bin/virtualenvwrapper.sh
source ~/.bashrc
The solution is to re-add python-related environment variables, first confirm the Python version that virtualenvwrapper depends on
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
mkvirtualenv env_name
# env_name is the name of the virtual environment you want to create, which needs to be connected to the Internet
mkvirtualenv -p /usr/bin/python3.6 python36_
mkvirtualenv -p /usr/bin/python2.7 python27_
workon
workon env_nam
deactivate
rmvirtualenv env_nam
Recommended Posts