0

我尝试使用它创建一个新的 virtualenv 目录,sudo virtualenv curdir -p /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7但它引发了以下错误:

Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.6.4', 'console_scripts', 'virtualenv')()
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/virtualenv.py", line 785, in main
    popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/subprocess.py", line 741, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/subprocess.py", line 1356, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 13] Permission denied

我知道我不被允许这样做,但为什么呢?python 2.7 位于那里,我想使用它。有没有办法在我的 virtualenv 中使用它?

我希望这不是一个太基本的问题。我对 Unix 命令行还是很陌生。

4

1 回答 1

3

你必须指向 python 可执行文件,你在这里没有做。它位于/Library/Frameworks/Python.framework/Versions/2.7/bin/python。运行这个

    sudo virtualenv curdir -p /Library/Frameworks/Python.framework/Versions/2.7/bin/python
于 2012-12-18T20:33:38.070 回答