无法在 Lion 中创建新的 Virtualenv
我在 Lion 中使用 virtualenv 时遇到问题。我已经重新安装了 Virtualenv 和 Pip,但在创建新环境时似乎很难找到 Pip。我删除了 virtualenvwrapper 以确保它不会造成干扰。
不幸的是,它正在查找的路径似乎在错误消息中被截断。
环境已部分创建,但没有激活脚本。这是回溯:
Apollos-Mac-mini:~ apollo$ virtualenv test
New python executable in test/bin/python
Installing setuptools............done.
Installing pip.............
Complete output from command /Users/apollo/test/bin/python /Users/apollo/test/bin/easy_install /Library/Python/2.7/...ort/pip-1.0.2.tar.gz:
Processing pip-1.0.2.tar.gz
Running pip-1.0.2/setup.py -q bdist_egg --dist-dir /var/folders/61/08st3n995qn_w6rsjqgv1cx00000gn/T/easy_install-Za9IA8/pip-1.0.2/egg-dist-tmp-lyVJEQ
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
warning: build_py: byte-compiling is disabled, skipping.
warning: install_lib: byte-compiling is disabled, skipping.
error: byte-compiling is disabled.
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.6.4', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 810, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 912, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 648, in install_pip
filter_stdout=_filter_setup)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 878, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/apollo/test/bin/python /Users/apollo/test/bin/easy_install /Library/Python/2.7/...ort/pip-1.0.2.tar.gz failed with error code 1
I'm having trouble with virtualenv in Lion. I've clean reinstalled Virtualenv and Pip it but it seems like it's struggling with finding Pip when creating a new environment. I removed virtualenvwrapper to make sure that's not interfering too.
Unfortunately the path it's looking in seems to be truncated in the error message.
The environment gets part created but there's no activate script. This is the traceback:
Apollos-Mac-mini:~ apollo$ virtualenv test
New python executable in test/bin/python
Installing setuptools............done.
Installing pip.............
Complete output from command /Users/apollo/test/bin/python /Users/apollo/test/bin/easy_install /Library/Python/2.7/...ort/pip-1.0.2.tar.gz:
Processing pip-1.0.2.tar.gz
Running pip-1.0.2/setup.py -q bdist_egg --dist-dir /var/folders/61/08st3n995qn_w6rsjqgv1cx00000gn/T/easy_install-Za9IA8/pip-1.0.2/egg-dist-tmp-lyVJEQ
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
warning: build_py: byte-compiling is disabled, skipping.
warning: install_lib: byte-compiling is disabled, skipping.
error: byte-compiling is disabled.
----------------------------------------
...Installing pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.6.4', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 810, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 912, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 648, in install_pip
filter_stdout=_filter_setup)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 878, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/apollo/test/bin/python /Users/apollo/test/bin/easy_install /Library/Python/2.7/...ort/pip-1.0.2.tar.gz failed with error code 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
蒂姆:从我从这个链接中看到的来看,你可能是对的 - https://bitbucket.org/tarek/distribute/issue/168/easy_install-fails-with-byte-compiling
在链接末尾还有您可能想要的另一个有趣的注释去检查一下。它说
“设置导出 VIRTUALENV_USE_DISTRIBUTE=1 解决了该问题。”
我建议您使用分发来安装软件包,因为它似乎比传统的安装工具给我带来的麻烦要少得多。使用 --distribute 选项,如下所示:-
无论如何,很高兴您解决了自己的问题! :-)
Tim: you are probably right from what I can see from this link - https://bitbucket.org/tarek/distribute/issue/168/easy_install-fails-with-byte-compiling
There's another interesting note at the end of the link which you might want to check out. It says
"Setting export VIRTUALENV_USE_DISTRIBUTE=1 fixed the problem."
I would recommend that you use distribute to install your packages as it seems to give me a lot less trouble than the traditional setuptools. Using the --distribute option like this:-
In any case, glad you solved your own question! :-)
这是当您在 Python 中禁用字节编译(.pyc 文件)时
easy_install
无法工作的问题。我在我的开发机器上这样做是因为当我删除原始 .py 时,由于使用 .pyc 文件,我一直在与错误作斗争。为了纠正这个问题,我
从
~/.profile
中删除了。calvinx的答案也通过使用distribute而不是easy_install解决了这个问题。我想这两个答案都可以被认为是正确的,但 calvinx 允许您继续禁用字节编译,所以我将其标记为正确的。
This is a problem with
easy_install
not working when you disable byte compiling (.pyc files) in Python. I did this on my development machine because I persistently struggled with bugs due to .pyc files being used when I'd deleted the original .py.To correct this I removed
from
~/.profile
.calvinx's answer also solves this by using distribute instead of easy_install. I suppose both answers could be considered correct but calvinx's allows you to continue disabling byte compiling so I'll mark that as correct.
我解决了这个问题,只是删除了所有 .pyc 文件
I solved it just removing all the .pyc files