Python environment preparation _ virtualenvwrapper

Source: Internet
Author: User

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

 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.