使用virtualenvwrapper-win传递不同的python版本时出错

时间:2015-04-10 17:13:14

标签: python windows virtualenv virtualenvwrapper

我安装了python 3.4和2.7,其路径为C:\ python34和C:\ python27。在尝试使用python 2.7创建virtualenv时,我收到以下错误:

    C:\Development>mkvirtualenv --python=C:\python27 env
    Running virtualenv with interpreter C:\python27
    Traceback (most recent call last):
      File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
        "__main__", mod_spec)
      File "C:\Python34\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Python34\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
      File "C:\Python34\lib\site-packages\virtualenv.py", line 784, in main
      popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
      File "C:\Python34\lib\subprocess.py", line 859, in __init__
         restore_signals, start_new_session)
      File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child
    startupinfo)
    PermissionError: [WinError 5] Access is denied
    The system cannot find the path specified.
    The system cannot find the path specified.
    The system cannot find the path specified.

here它说:

  

如果使用多个版本的python,可以使用单独的项目pywin在它们之间切换。它是我为Windows命令行和MSYS / MINGW32编写的轻量级python 2.5-3.3启动器和切换器。它类似于python 3.3中提供的py.exe启动程序/切换器,但是使用基本的Windows批处理脚本和用于MSYS / MINGW32支持的shell脚本编写。我使用msysgit中基于MSYS / MINGW32的bash和命令行shell工具来完成我在Windows上的大部分python开发。

我有pywin但不知道如何使用不同的python版本设置virtualenv。

我不确定我的问题是什么,任何帮助都会受到赞赏。

我应该补充一点,我可以在不使用virtualenvwrapper-win的情况下使用python 2.7来使用virtualenv。

1 个答案:

答案 0 :(得分:3)

我今天正在努力解决这个问题。您需要指定 python.exe 文件。

mkvirtualenv -p C:/Python27/python.exe myenv

希望它有所帮助!