如何讓 pip 再次發揮作用?

如何讓 pip 再次發揮作用?

我在執行 pip 嘗試安裝 rpyc 時遇到了以下問題。即使我嘗試在沒有任何參數的情況下運行 pip,它仍然會輸出相同的錯誤。任何幫助將不勝感激,謝謝。

volt72@killadelph:~/zone/zone$ pip
Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 2691, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 668, in subscribe
    callback(dist)
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 2691, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 2192, in activate
    self.insert_on(path)
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 2293, in insert_on
    "with distribute. Found one at %s" % str(self.location))
ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /usr/local/lib/python2.7/dist-packages/setuptools-20.7.0-py2.7.egg
volt72@killadelph:~/zone/zone$ 

答案1

好吧,經過一番研究後,我決定執行以下操作:

rm /usr/local/lib/python2.7/dist-packages/setuptools-20.7.0-py2.7.egg
sudo apt-get purge python-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

現在 pip 可以正常工作了。

答案2

我透過刪除分發解決了這個問題

sudo pip uninstall distribute

相關內容