Virtualenv is used to create multiple standalone Python runtime environments on a single machine, Virtualenvwrapper provides some handy package on the command line.
-Isolation of third-party package dependencies between projects, such as a project dependent on Django1.7.8,b project Dependencies django1.8.2
-To facilitate the deployment of applications, the development environment of the virtual environment packaged in a production environment, do not need to be on the server again.
Pip install Virtualenvwrapperecho '/usr/local/bin/virtualenvwrapper.sh ' |sudo tee-a ~/.bash_profilesource ~/.bash_ Profile
Create a virtual environment
Mkvirtualenv django_test01
switching environments
The default is to use the currently created virtual environment, or you can use the command switch
Workon django_test01# using django_test01 Environment Deactivate #退出当前环境, enter system pythonshowvirtualenv [DJANGO_TEST01] # Displays details of the specified environment rmvirtualenv [django_test01] #移除指定的虚拟环境, removing the premise that you are not currently working in that environment. If working in this environment, first use deactivate to exit cpvirtualenv [source] [dest] #复制一份虚拟环境. cdvirtualenv [SubDir] #把当前工作目录设置为所在的环境目录. cdsitepackages [SubDir] #把当前工作目录设置为所在环境的sitepackages路径. add2virtualenv [dir] [dir] #把指定的目录加入当前使用的环境的path中, which is often used in situations where a larger library is used simultaneously in multiple project. Toggleglobalsitepackages-q #控制当前的环境是否使用全局的sitepackages目录
Python Environment Preparation _virtualenvwrapper