2

尝试更新我的 virtualenv 中的 python 安装或创建新的 virtualenv 时会发生这种情况:

[marcintustin@localhost oneclickrep]$ virtualenv --always-copy --clear --python=/usr/bin/python oneclickcosvirt/ 
Already using interpreter /usr/bin/python
Deleting tree oneclickcosvirt/lib/python2.7
Not deleting oneclickcosvirt/bin
New python executable in oneclickcosvirt/bin/python
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.10.1', 'console_scripts', 'virtualenv')()
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 821, in main
    symlink=options.symlink)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 956, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 1377, in install_python
    shutil.copyfile(py_executable_base, full_pth)
  File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: 'python'
[marcintustin@localhost oneclickrep]$ 

结果与上述一致。/usr/bin/python存在并且工作得很好(它也是由 拾取的python which)。这是什么原因?

编辑:使用 virtualenv 版本 1.10.1

4

1 回答 1

4

这是 virtualenv 的一个错误。使用该--always-copy标志会触发复制行为,该行为已损坏。已经提交了错误报告和补丁。

该行shutil.copyfile(py_executable_base, full_pth)应该是shutil.copyfile(py_executable, full_pth).

于 2013-11-07T20:40:24.483 回答