Windows下用Python 3.4+自带的venv模块创建虚拟环境
来源:互联网 发布:photoshop cs4 mac版 编辑:程序博客网 时间:2024/05/30 04:20
Windows下用Python 3.4+自带的venv模块创建虚拟环境
Python 3.4+自带了venv模块,用于创建虚拟环境,每个虚拟环境都可以安装一套独立的第三方模块。
本文在Windows 10上操作。
原文:http://www.cnblogs.com/animalize/p/5868763.html
1、创建一个虚拟环境:
D:\>mkdir test_venvD:\>cd test_venvD:\test_venv>python -m venv test
第三行,使用venv模块创建一个名为test的虚拟环境。
执行后,生成了一个test目录,内有1个文件、3个目录:
test
│ pyvenv.cfg
│
├─Include
├─Lib
└─Scripts
2、启用虚拟环境:
D:\test_venv>test\Scripts\activate.bat(test) D:\test_venv>
执行那个activate.bat文件,启用后,提示符前面会出现虚拟环境的名字(test)。
3、用pip给虚拟环境安装模块:
用pip list看一下已有的模块,能看到只有两个Python自带的模块:
(test) D:\test_venv>pip listpip (8.1.1)setuptools (20.10.1)You are using pip version 8.1.1, however version 8.1.2 is available.You should consider upgrading via the 'python -m pip install --upgrade pip' command.
提示pip有新版本,按提示用'python -m pip install --upgrade pip'命令更新就好了。
在虚拟环境里,千万别用'pip install --upgrade pip'更新pip,这会破坏pip。
现在,给虚拟环境安装tornado试试:
(test) D:\test_venv>pip install tornadoCollecting tornado Using cached tornado-4.4.1-cp35-cp35m-win_amd64.whlInstalling collected packages: tornadoSuccessfully installed tornado-4.4.1
已成功安装tornado。
4、退出虚拟环境:
(test) D:\test_venv>test\Scripts\deactivate.batD:\test_venv>
执行deactivate.bat后,退出虚拟环境,此时命令行提示符前的(test)消失了。
0 0
- Windows下用Python 3.4+自带的venv模块创建虚拟环境
- Windows下用Python 3.4+自带的venv模块创建虚拟环境
- Python 3 使用venv创建虚拟环境
- Python3 venv 创建虚拟环境
- python venv 虚拟环境配置 gpu
- Windows下创建python虚拟环境
- windows 用virtualenv创建不同python版本的虚拟环境
- Windows下用PowerShell激活Python的虚拟环境
- windows环境下python虚拟环境的搭建
- Windows的wamp环境下创建虚拟站点/虚拟目录
- Ubuntu系统下python虚拟环境的创建和使用
- windows下 python 自带的CGIHTTPServer使用
- 利用python自带的os模块删除windows机器的模块
- windows 下使用 virtualenv 创建虚拟环境
- Windows下使用conda创建虚拟环境
- Python的虚拟环境安装(windows下)
- MAC下创建python虚拟环境
- Ubuntu下创建python虚拟开发环境
- 再测JAVA性能比C/C++好问题
- Error:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:
- idea突然打不开 connot load project
- 2016.12.15回顾 mysql截取字符串
- Java内存布局和类加载的一些总结
- Windows下用Python 3.4+自带的venv模块创建虚拟环境
- 使用MulticastSocket实现多点广播
- 机器学习方法:EM算法
- 九度数组中第K小的数字
- H5学习资料
- XE下有效减少DevExpress皮肤控件带来体积巨大的方法
- Vue构建单页应用最佳实战
- 介绍几个程序员在iapd上玩的游戏
- 使用Spydroid(libstreaming)作为rtsp server