码迷,mamicode.com
首页 > 编程语言 > 详细

python虚拟环境

时间:2017-07-13 16:20:14      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:tools   form   name   elf   set   self   tool   tor   virt   

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        #查看目录
驱动器 C 中的卷没有标签。
卷的序列号是 FE12-B6A3

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 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 可用字节

C:\Users\Administrator\testdir1>cd Scripts

C:\Users\Administrator\testdir1\Scripts>dir
驱动器 C 中的卷没有标签。
卷的序列号是 FE12-B6A3

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 个文件 4,364,039 字节
2 个目录 45,641,494,528 可用字节

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>

 

python虚拟环境

标签:tools   form   name   elf   set   self   tool   tor   virt   

原文地址:http://www.cnblogs.com/zcx-python/p/7160284.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!