[Reprint]windows under Install Python virtual environment Virtualenvwrapper-win

Source: Internet
Author: User

1 Preface

Because of the numerous versions of Python, there are also Python2 and Python3 debates, so some packages or third-party libraries are prone to version incompatibility issues.

With virtualenv This tool, you can build a series 虚拟的Python环境 , and then install the required packages (in conjunction with each other) in each environment pip , a series of environments that are isolated from each other. As a standalone environment, version issues are not easily available and are also easy to deploy.

2 install pip install virtualenv3 virtualenv Basic use 3.1 Create a virtual environment virtualenv venv

To specify the Python interpreter for the environment:

virtualenv3.2 activating a virtual environment activate venv3.3 stopping a virtual environment deactivate3.4 deleting a virtual environment

Delete the directory directly.

Rmvirtualenv venv4 Virtualenvwrapper

In order to use the virtualenv more convenient, you can rely onvirtualenvwrapper

4.1 Installing VIRTUALENVWRAPPERPIP Install virtualenvwrapper4.2 Creating a virtual environment

The virtual environment created by default is located in C:\Users\username\envsand can be customized by environment variables WORKON_HOME .

By computer--Properties--Advanced system settings--environment variables--NEW "variable name" in System variables: workon_home, Variable value: "Your custom Path".

Once created, the environment is automatically activated, taking note of changes to the shell prompt:

(venv) c:\>

4.3 List all virtual environments lsvirtualenv4.4 activating the virtual environment Workon venv4.5 into the virtual environment directory cdvirtualenv4.6 Enter the Site-packages directory for the virtual environment cdsitepackages4.7 list all packages of the Site-packages directory lssitepackages4.8 Stop the virtual environment deactivate4.9 Deleting a virtual Environment rmvitualenv venv5 rebuilding a Python environment 5.1 freezing environment

The so-called 冻结(freeze) environment, is the current environment of the package, such as fixed down:

pip freeze >packages.txt  # 安装包列表保存到文件packages.txt中5.2 Rebuilding the Environment

重建(rebuild)The environment is in the deployment, install the corresponding version of the package in the production environment, do not appear version compatibility issues:

pip install -r packages.txt

With PIP, you can install the corresponding version of the package in batches, quickly rebuild the environment, complete the deployment.

From:http://www.cnblogs.com/suke99/p/5355894.html

Section has comments

[Reprint]windows under Install Python virtual environment Virtualenvwrapper-win

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.