Python environment preparation _ virtualenvwrapper
VirtualEnv is what VirtualEnv is used to create multiple independent python runtime environments on one machine. VirtualEnvWrapper provides some convenient command line encapsulation for the former. Why use-isolate third-party package dependencies between projects, for example, project A depends on django1.7.8, and Project B depends on django1.8.2-to facilitate application deployment and package the virtual environment of the development environment to the production environment, you do not need to roll over the server. Install
pip install virtualenvwrapperecho '/usr/local/bin/virtualenvwrapper.sh'|sudo tee -a ~/.bash_profilesource ~/.bash_profile
Common commands to create a virtual environment
mkvirtualenv django_test01
By default, the new virtual environment is used to switch the environment.
Workon django_test01 # Use django_test01 environment deactivate # exit the current environment and enter the system Pythonshowvirtualenv [django_test01] # display details of the specified environment rmvirtualenv [django_test01] # Remove the specified Virtual Environment, the premise is that it is not currently working in this environment. If you work in this environment, use deactivate to exit cpvirtualenv [source] [dest] # copy a virtual environment. Cdvirtualenv [subdir] # set the current working directory to the environment directory. Cdsitepackages [subdir] # set the current working directory to the sitepackages path of the environment. Add2virtualenv [dir] [dir] # Add the specified directory to the path of the currently used environment. This is often used when a large library is used in multiple projects. Toggleglobalsitepackages-q # control whether the current environment uses the Global sitepackages directory