python虛擬環境

pip3 install virtualenv   #安裝虛擬環境python

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

C:\Users\Administrator>cd testdir1       #進入目錄json


C:\Users\Administrator\testdir1>dir        #查看目錄
驅動器 C 中的卷沒有標籤。
卷的序列號是 FE12-B6A3windows

C:\Users\Administrator\testdir1 的目錄app

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 60 pip-selfcheck.json
2017/07/13 14:25 <DIR> Scripts
2017/07/13 14:24 <DIR> tcl
1 個文件 60 字節
6 個目錄 45,641,490,432 可用字節ui

C:\Users\Administrator\testdir1>cd Scriptsthis

C:\Users\Administrator\testdir1\Scripts>dir
驅動器 C 中的卷沒有標籤。
卷的序列號是 FE12-B6A3orm

C:\Users\Administrator\testdir1\Scripts 的目錄ip

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 個文件 4,364,039 字節
2 個目錄 45,641,494,528 可用字節rem

C:\Users\Administrator\testdir1\Scripts>activate.bat              #啓用該虛擬環境


(testdir1) C:\Users\Administrator\testdir1\Scripts>pip3 list
DEPRECATION: The default format will 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             (windows 安裝 virtualenv的加強版)
pip3 install virtualenvwrapper                (linux 安裝 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>

相關文章
相關標籤/搜索