我无法访问任何virtualenv管理命令,例如Get-VirtualEnvironment。 我在Windows-XP中执行了以下操作:
但是,当我运行Get-Command virtualenv
时,我得到一行作为回复,而不是virtualenv命令列表。
答案 0 :(得分:0)
首先:使用pip install安装virtualenv(在Python \Scripts
目录中)
C:\Python2\Scripts>pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-1.11.5.tar.gz (1.8MB): 1.8MB downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*' found under directory 'do
cs\_templates'
warning: no previously-included files matching '*' found under directory 'do
cs\_build'
Installing collected packages: virtualenv
Running setup.py install for virtualenv
warning: no previously-included files matching '*' found under directory 'do
cs\_templates'
warning: no previously-included files matching '*' found under directory 'do
cs\_build'
Installing virtualenv-script.py script to C:\Python2\Scripts
Installing virtualenv.exe script to C:\Python2\Scripts
Installing virtualenv.exe.manifest script to C:\Python2\Scripts
Installing virtualenv-2.7-script.py script to C:\Python2\Scripts
Installing virtualenv-2.7.exe script to C:\Python2\Scripts
Installing virtualenv-2.7.exe.manifest script to C:\Python2\Scripts
Successfully installed virtualenv
Cleaning up...
第二名:创建名为env01的虚拟环境(或者您喜欢)。
C:\Python2\Scripts>virtualenv ..\env01
New python executable in ..\env01\Scripts\python.exe
Installing setuptools, pip...done.
第三:转到en virtualenv dir created
C:\Python2\Scripts>cd ..\env01
C:\Python2\env01>dir
El volumen de la unidad C es ********
El número de serie del volumen es: ****-****
Directorio de C:\Python2\env01
03/05/2014 19:25 <DIR> .
03/05/2014 19:25 <DIR> ..
15/01/2014 16:33 <DIR> Include
03/05/2014 19:25 <DIR> Lib
03/05/2014 19:25 <DIR> Scripts
0 archivos 0 bytes
5 dirs 11.779.756.032 bytes libres
第四:执行activate.bat
dir中的<your_virtualenv>\Scripts\
脚本
C:\Python2\env01>.\Scripts\activate
**(env01) C:\Python2\env01>**
提醒您使用deactivate.bat脚本停用virtualenv:
(env01)C:\ Python2 \ env01&gt;停用
C:\ Python2 \ env01&GT;
它也适用于Python3。