Original address: blog.sina.com.cn/s/blog_4ddef8f80101eu0w.html
Python's virtual environment allows a Python program to have a separate library and interpreter interpreter, without sharing a unified library and interpreter with other Python programs. The benefit of a virtual environment is to avoid the interaction between different Python programs (using the Global Library and interpreter), for example, program a requires a 1.0 version of a library, and program B needs the same 2.0 version of the library, and if program B executes then a cannot be executed.
Install virtualenv :
pip Install virtualenv
Create a virtual environment
virtualenv venv
Venv is the name of the newly created virtual environment. It also creates a folder venv with the same name as the virtual environment, which stores a separate Python execution environment.
Enter virtual environment
source venv/bin/activate
After entering the virtual environment, the command line prompt will be added to the name of the virtual environment, for example: (venv) [email protected]:~$
Exiting a virtual environment $
deactivate
Deleting a virtual environment
Rm-r venv
Delete the venv virtual environment we created by deleting the folder venv the virtual environment.
Details and virtualenvwrapper and autoenv please read:
http://docs.python-guide.org/en/latest/dev/virtualenvs/
Python's Virtual Environment virtualenv