0

我在 Windows 7 上将 Python 2.6 作为我的默认 python,我正在尝试使用 Python 2.7 获得虚拟环境

我在 C:\Python26 中有 python 2.6,在 C:\Python27 中有 python 2.7

当我尝试使用时,virtualenv -p我得到了这个

C:\web\xxx>virtualenv -p "C:\Python27\python.exe" --no-site-packages venv
Running virtualenv with interpreter C:\Python27\python.exe
Traceback (most recent call last):
  File "C:\Python26\lib\site-packages\virtualenv.py", line 2577, in <module>
    main()
  File "C:\Python26\lib\site-packages\virtualenv.py", line 979, in main
    no_pip=options.no_pip)
  File "C:\Python26\lib\site-packages\virtualenv.py", line 1081, in create_environment
    site_packages=site_packages, clear=clear))
  File "C:\Python26\lib\site-packages\virtualenv.py", line 1277, in install_python
    copy_required_modules(home_dir)
  File "C:\Python26\lib\site-packages\virtualenv.py", line 1215, in copy_required_modules
    dst_filename = change_prefix(filename, dst_prefix)
  File "C:\Python26\lib\site-packages\virtualenv.py", line 1185, in change_prefix
    (filename, prefixes)
AssertionError: Filename C:\Python26\Lib\os.py does not start with any of these prefixes: ['C:\\Python27']

难道我做错了什么?

4

1 回答 1

1

我用我想要的 python 运行 virtualenv 并且不使用 -p 选项:

(编辑修复路径)

C:\web\xxx>C:\Python27\python c:\path\to\virtualenv.py --no-site-packages venv
于 2013-04-28T00:44:23.933 回答