在Virtualenv中使用Python的Pip
问题描述:
我一直在Python中使用Heroku的雪松堆栈一段时间,没有任何错误。然而今天,当我决定在我的经sudo bin/pip install -r requirements
virtualenv
我收到以下错误更新我的依赖本地,:在Virtualenv中使用Python的Pip
Traceback (most recent call last):
File "/Users/alex/Desktop/dev/warren/warren/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/Users/alex/Desktop/dev/warren/warren/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 698, in <module>
File "/Users/alex/Desktop/dev/warren/warren/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 701, in Environment
File "/Users/alex/Desktop/dev/warren/warren/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 96, in get_supported_platform
File "/Users/alex/Desktop/dev/warren/warren/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 221, in get_build_platform
File "/Users/alex/Desktop/dev/warren/warren/lib/python2.6/distutils/__init__.py", line 16, in <module>
exec(open(os.path.join(distutils_path, '__init__.py')).read())
IOError: [Errno 2] No such file or directory: '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/__init__.py'
我怀疑这有某事与我升级到狮子(如指出, this question),但正如在那个问题中提到的,我也更新了Xcode,但问题仍然存在。
当我尝试cd
到上面的目录没有__init__.py
文件,其实还有所有,只是.pyo
和.pyc
文件没有.py
文件。
答
您收到的错误消息是由于virtualenv为您的系统python创建的链接。您现在想要销毁virtualenv并重新创建它。要消灭它,你会想:
rm -r bin
rm -r include
rm -r lib
rm .Python
那么你应该能够重新创建你的virtualenv然后点子安装你requirements.txt
什么是用于运行virtualenv中的命令行? – Mark
尝试不使用“sudo”。你不需要virtualenv中的root权限。 –
@Mark'source bin/activate'。 –