python 使用特定 python 版本创建 virtualenv 失败
python make virtualenv with specific python version fails
我习惯于 ruby 指定 ruby gemset 和 ruby 版本使用
.ruby-version
.ruby-gemset
在 python 中,您似乎必须使用以下语法:
mkvirtualenv --python /usr/local/opt/pyenv/versions/3.4.2 test1
但它失败并显示以下输出:
Running virtualenv with interpreter /usr/local/opt/pyenv/versions/3.4.2
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 784, in main
popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
当 运行 未指定 python 版本时,它的工作方式如下:
mkvirtualenv test2 ✱
New python executable in test2/bin/python2.7
Also creating executable in test2/bin/python
Installing setuptools, pip...done.
您需要指定实际的 python 可执行文件名称...例如virtualenv -p /usr/local/bin/python2.7 py2.7
或 virtualenv -p /usr/local/bin/python3 py3
,不是目录。两者都应该在 OS X 上使用 Homebrew 安装的 Python 版本,fwiw...
我习惯于 ruby 指定 ruby gemset 和 ruby 版本使用
.ruby-version
.ruby-gemset
在 python 中,您似乎必须使用以下语法:
mkvirtualenv --python /usr/local/opt/pyenv/versions/3.4.2 test1
但它失败并显示以下输出:
Running virtualenv with interpreter /usr/local/opt/pyenv/versions/3.4.2
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 784, in main
popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
当 运行 未指定 python 版本时,它的工作方式如下:
mkvirtualenv test2 ✱
New python executable in test2/bin/python2.7
Also creating executable in test2/bin/python
Installing setuptools, pip...done.
您需要指定实际的 python 可执行文件名称...例如virtualenv -p /usr/local/bin/python2.7 py2.7
或 virtualenv -p /usr/local/bin/python3 py3
,不是目录。两者都应该在 OS X 上使用 Homebrew 安装的 Python 版本,fwiw...