Most Linux comes with python2.7, but Ubuntu1.6 also comes python3.x, this article is mainly recorded virtualenv + vitualenvwrapper use python3 virtual environment.
Virtual environment benefit more than that, to avoid version changes, making the development of action independently of each other
First, install virtualenv, command
sudo apt-get install python-virtualenv
# Second, the installation virtualwrapper
virtualwrapper is a simple and convenient tool for managing virtual environments, use the command
sudo pip install virtualenvwrapper
Third, the environment variable configuration virtualwrapper
1, vim open ./bashrc
sudo vim ~/.bashrc
2, shift + g to reach the final text, the most by adding the following under the name
export WORK_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
3, the implementation ./bashrc
source ~/.bashrc 命令之后才会生效
Using four basic commands
1, to create a virtual environment
mkvirtualenv 环境名(此环境是根据系统变量环境创建的,即py2)
Creating python3 environment
mkvirtualenv --python=/usr/bin/pyhton3 name
2, enter the virtual environment
workon name
3, exit the virtual environment
deactivate
4. Delete the virtual environment
rmvirtualenv name