Python Virtual Environment

Source: Internet
Author: User
Tags virtual environment virtualenv

PIP3 Install virtualenv #安装虚拟环境

C:\users\administrator>virtualenv Testdir1 #创建一个名为testdir1的虚拟python环境
Using base prefix ' d:\\python\\python36 '
New python executable in C:\Users\Administrator\testdir1\Scripts\python.exe
Installing Setuptools, Pip, Wheel...done.

C:\USERS\ADMINISTRATOR>CD Testdir1 #进入目录


C:\users\administrator\testdir1>dir #查看目录
The volume in drive C is not labeled.
The serial number of the volume is FE12-B6A3

Directory of C:\Users\Administrator\testdir1

2017/07/13 14:25 <DIR>.
2017/07/13 14:25 <DIR>.
2017/05/05 11:53 <DIR> Include
2017/07/13 14:24 <DIR> Lib
2017/07/13 14:25 Pip-selfcheck.json
2017/07/13 14:25 <DIR> Scripts
2017/07/13 14:24 <DIR> tcl
1 Files 60 bytes
6 Directories 45,641,490,432 bytes available

C:\USERS\ADMINISTRATOR\TESTDIR1>CD Scripts

C:\users\administrator\testdir1\scripts>dir
The volume in drive C is not labeled.
The serial number of the volume is FE12-B6A3

Directory of C:\Users\Administrator\testdir1\Scripts

2017/07/13 14:25 <DIR>.
2017/07/13 14:25 <DIR>.
2017/07/13 14:25 2,197 Activate
2017/07/13 14:25 771 Activate.bat
2017/07/13 14:25 8,325 Activate.ps1
2017/07/13 14:25 1,137 activate_this.py
2017/07/13 14:25 508 Deactivate.bat
2017/07/13 14:24 98,181 Easy_install-3.6.exe
2017/07/13 14:24 98,181 Easy_install.exe
2017/07/13 14:25 98,153 Pip.exe
2017/07/13 14:25 98,153 Pip3.6.exe
2017/07/13 14:25 98,153 Pip3.exe
2017/07/13 14:24 100,504 Python.exe
2017/07/13 14:24 3,562,648 Python36.dll
2017/07/13 14:24 98,968 Pythonw.exe
2017/07/13 14:25 98,160 Wheel.exe
14 Files 4,364,039 bytes
2 Directories 45,641,494,528 bytes available

C:\users\administrator\testdir1\scripts>activate.bat #启用该虚拟环境


(TESTDIR1) C:\USERS\ADMINISTRATOR\TESTDIR1\SCRIPTS>PIP3 List
Deprecation:the default format would switch to columns in the future. You can use--format= (legacy|columns) (or define a format= (Legacy|columns) in your Pip.con
f under the [List] section) to disable this warning.
Pip (9.0.1)
Setuptools (36.0.1)
Wheel (0.29.0)

(TESTDIR1) C:\users\administrator\testdir1\scripts>


PIP3 Install Virtualenvwrapper-win (Enhanced version of Windows installation virtualenv)
PIP3 Install Virtualenvwrapper (enhanced version of Linux installation virtualenv)

C:\USERS\ADMINISTRATOR>PIP3 Install Virtualenvwrapper-win
Collecting Virtualenvwrapper-win
Requirement already satisfied:virtualenv in D:\python\python36\lib\site-packages (from Virtualenvwrapper-win)
Installing collected Packages:virtualenvwrapper-win
Successfully installed virtualenvwrapper-win-1.2.1

C:\users\administrator>mkvirtualenv Testdir2 #创建一个名为testdir2的python虚拟环境
Using base prefix ' d:\\python\\python36 '
New python executable in C:\Users\Administrator\Envs\testdir2\Scripts\python.exe
Installing Setuptools, Pip, Wheel...done.

(TESTDIR2) C:\users\administrator>workon #查看所有虚拟环境列表

Pass a name to activate one of the following Virtualenvs:
==============================================================================
Mxonline
Testdir2
Testvir2

(TESTDIR2) C:\users\administrator>workon Testdir2 #切换虚拟环境workon
(TESTDIR2) C:\users\administrator>workon Mxonline
(Mxonline) C:\users\administrator>deactivate #退出虚拟环境

C:\users\administrator>

Python Virtual Environment

Related Article

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.