当我尝试将python版本定义为2.7时,为什么virtualenv会抛出错误?

时间:2012-12-18 20:08:18

标签: python python-2.7 virtualenv

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

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命令行的新手。

1 个答案:

答案 0 :(得分:3)

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

    sudo virtualenv curdir -p /Library/Frameworks/Python.framework/Versions/2.7/bin/python