python虚拟环境
2021/5/21 20:25:47
本文主要是介绍python虚拟环境,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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虚拟环境的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-27Python编程入门指南
- 2024-12-27Python编程基础
- 2024-12-27Python编程基础教程
- 2024-12-27Python编程基础指南
- 2024-12-24Python编程入门指南
- 2024-12-24Python编程基础入门
- 2024-12-24Python编程基础:变量与数据类型
- 2024-12-23使用python部署一个usdt合约,部署自己的usdt稳定币
- 2024-12-20Python编程入门指南
- 2024-12-20Python编程基础与进阶