python - 在不同的 python 版本中使用 virtualenvwrapper-win 时出错

标签 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它说:

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.

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

我不确定我的问题是什么,我们将不胜感激。

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

最佳答案

我今天正在为这个问题苦苦挣扎。您需要指定 python.exe 文件。

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

希望对您有所帮助!

关于python - 在不同的 python 版本中使用 virtualenvwrapper-win 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29567097/

相关文章:

django - 带有Upstart和Nginx的Gunicorn和Django

python - 在虚拟环境中安装我自己的 python 模块

Windows 上的 Python。为什么读取文本比二进制文件慢 8 倍?

python - 全局名称 'doc' 未定义,从一个函数到另一个函数的 vcall 出现问题

javascript - 将 JS 对象提取为 JSON

python - 从列表中调用函数 - Python

c# - 任务栏上的子组

android - 带有 Visual Studio 的 Android 模拟器上的奇怪解决方案

python - pyvenv 无法工作,因为 Ensurepip 不可用

python - 运行一段时间后,NoneType'对象在Django中没有属性 'objects'