2011-11-22 42 views
1

我一直在Python中使用Heroku的雪松堆栈一段时间,没有任何错误。然而今天,当我决定在我的经sudo bin/pip install -r requirementsvirtualenv我收到以下错误更新我的依赖本地,:在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文件。

+0

什么是用于运行virtualenv中的命令行? – Mark

+0

尝试不使用“sudo”。你不需要virtualenv中的root权限。 –

+1

@Mark'source bin/activate'。 –

回答

4

您收到的错误消息是由于virtualenv为您的系统python创建的链接。您现在想要销毁virtualenv并重新创建它。要消灭它,你会想:

rm -r bin 
rm -r include 
rm -r lib 
rm .Python 

那么你应该能够重新创建你的virtualenv然后点子安装你requirements.txt