如何为Windows PowerShell设置virtualenvwrapper?

时间:2013-12-14 14:34:27

标签: python powershell virtualenvwrapper

我安装了这个

  • 在Windows 7上
  • Python 2.7.6(我的默认设置,安装了virtualenv)
  • Python 2.4.4
  • Python 2.5.4
  • Python 2.6.6
  • Python 3.3.3
  • virtualenv 1.10.1
  • virtualenvwrapper_powershell-12.7.8-py2.7

我想在所有这些python安装上测试代码。

(关于缺少对Python 2.4./2.5的支持的相关问题: How do I setup virtualenv environments for Python 2.4 and 2.5 versions on Windows?

这是我到目前为止所尝试的:

直接尝试virtualenv:

Python 2.6按预期工作:

C:\Users\martin\.virtualenvs>virtualenv -p c:\apps\Python26\python.exe env26
Running virtualenv with interpreter c:\apps\Python26\python.exe
New python executable in env26\Scripts\python.exe
Installing Setuptools..............done.
Installing Pip.............done.

C:\Users\martin\.virtualenvs>env26\Scripts\activate
(env26) C:\Users\martin\.virtualenvs>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Python 2.7和3.3也可以按预期工作。

尝试使用virtualenvwrapper:

Python 2.6,2.7和3.3按预期工作:

C:\Users\martin\.virtualenvs>mkvirtualenv -p c:\apps\Python26\python.exe env26_w

Running virtualenv with interpreter c:\apps\Python26\python.exe
New python executable in env26_w\Scripts\python.exe
Installing Setuptools.........done.
Installing Pip................done.

(env26_w) C:\Users\martin\.virtualenvs>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

在Powershell上尝试virtualenvwrapper:

创建和激活Python 2.6不会出错,但会启动Python27 激活时:

PS C:\Users\martin> mkvirtualenv -p C:\apps\Python26\python.exe env_26_ps
New python executable in env_26_ps\Scripts\python.exe
Installing Setuptools........done.
Installing Pip.......................done.
Added activation script por Powershell to C:\Users\martin\.virtualenvs/env_26_ps\Scripts.
(env_26_ps)PS C:\Users\martin> python
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

env_26_ps\Scripts文件夹包含pip-2.7.exepython.exe(2.7)等文件。

Python 3.3的类似行为

0 个答案:

没有答案