Python Environment Preparation _virtualenvwrapper

Source: Internet
Author: User

    • What is Virtualenv?

Virtualenv is used to create multiple standalone Python runtime environments on a single machine, Virtualenvwrapper provides some handy package on the command line.

    • Why do you use

-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.

    • Installation

Pip install Virtualenvwrapperecho '/usr/local/bin/virtualenvwrapper.sh ' |sudo tee-a ~/.bash_profilesource ~/.bash_ Profile
    • Common commands

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

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.