无法再使用 pip

发布于 2024-11-30 17:36:58 字数 1075 浏览 0 评论 0原文

当我尝试使用 pip 时,遇到了这个错误:

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.0.2', 'console_scripts', 'pip')()
  File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 2281, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 1996, in load
    raise ImportError("%r has no %r attribute" % (entry,attr))
ImportError: <module 'pip' from '/usr/lib/pymodules/python2.6/pip/__init__.pyc'> has no 'main' attribute

显然,我对系统做了一些更改,导致了 pip 的损坏。但我不知道那是什么。出现上述异常的原因可能是什么?

编辑:

我可以猜测的是,今天早上,我创建了一个 virtualenv,通过运行以下命令安装了我自己编写的包:

python setup.py 安装

顺便说一句,我确实尝试通过运行 get-pip.py 重新安装 pip,但没有成功

When I try to use pip, I met this error:

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.0.2', 'console_scripts', 'pip')()
  File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 2281, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.6/dist-packages/distribute-0.6.21-py2.6.egg/pkg_resources.py", line 1996, in load
    raise ImportError("%r has no %r attribute" % (entry,attr))
ImportError: <module 'pip' from '/usr/lib/pymodules/python2.6/pip/__init__.pyc'> has no 'main' attribute

Obviously, I made some change to the system that broke pip. But I've no idea what it is. What might cause the exception above?

Edit:

What I can guess is that this morning, I crated a virtualenv, installed a package written by myself by running:

python setup.py install

in that environment.

BTW, I did try to reinstall pip by running get-pip.py, didn't work

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一城柳絮吹成雪 2024-12-07 17:36:58

我注意到,distribute 安装在 /usr/local 中,但 pip 位于 /usr/lib 中,所以我猜测您在系统范围内安装了旧版本的 pip这在某种程度上覆盖了您所 easy_installpip 的内容。我会开始在那里寻找。

I note that distribute is installed in /usr/local but pip is in /usr/lib, so I'm guessing that you have an older version of pip installed system wide that is somehow overriding what you're easy_installed or piped. I'd start looking there.

彻夜缠绵 2024-12-07 17:36:58

使用 easy_install 重新安装。关闭终端并重新打开。 Pip 现在应该可以工作了。

Reinstall using easy_install. Close the terminal and reopen. Pip should now work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文