Error using virtualenvwrapper-win passing in different python version

一笑奈何 提交于 2019-12-21 02:37:09

问题


I have python 3.4 and 2.7 installed, the paths to those are C:\python34 and C:\python27. In attempting to make a virtualenv using python 2.7 I get the following errors:

    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 it says:

If you use several versions of python, you can switch between them using a separate project pywin. It’s a lightweight python 2.5-3.3 launcher and switcher I wrote for the Windows command line and MSYS/MINGW32. It’s similar to the py.exe launcher/switcher available in python 3.3, but written with basic Windows batch scripts and a shell script for MSYS/MINGW32 support. I use bash and command line shell tools from msysgit, based on MSYS/MINGW32, to do most of my python development on Windows.

I have pywin but don't know how to set up a virtualenv with a different python version using that.

I'm not sure what my problem is, any help would be appreciated.

I should add that I CAN use virtualenv using python 2.7 without using virtualenvwrapper-win.


回答1:


I was struggling with this problem today. You need to specify the python.exe file.

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

Hope it helps!



来源:https://stackoverflow.com/questions/29567097/error-using-virtualenvwrapper-win-passing-in-different-python-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!