2017-02-12 178 views
2

與pip一起運行命令會導致以下錯誤。即使命令pip -V也會產生以下錯誤。
我讀到該錯誤是由於setuptools版本31.0.0,它應該低於28.0.0。但是我的setuptools版本是26.1.1,它仍然給出相同的錯誤。Pip在升級到ubuntu-16.10後無法正常工作

 
Traceback (most recent call last): 
    File "/usr/local/bin/pip", line 7, in 
    from pip import main 
    File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 26, in 
    from pip.utils import get_installed_distributions, get_prog 
    File "/usr/local/lib/python3.5/dist-packages/pip/utils/__init__.py", line 27, in 
    from pip._vendor import pkg_resources 
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in 
    @_call_aside 
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside 
    f(*args, **kwargs) 
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set 
    dist.activate(replace=False) 
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate 
    declare_namespace(pkg) 
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace 
    _handle_ns(packageName, path_item) 
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns 
    _rebuild_mod_path(path, packageName, module) 
    File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in _rebuild_mod_path 
    orig_path.sort(key=position_in_sys_path) 
AttributeError: '_NamespacePath' object has no attribute 'sort' 
+0

從pid GitHub問題跟蹤器中的[this comment](https://github.com/pypa/pip/issues/4216#issuecomment-273189975)可能會有比您在此處顯示的回溯更多的回溯。你能否讓我們知道這是所有的追溯,還是之前有更多?後者可能是相關的,因爲GitHub註釋中的一部分顯示了發生在'/ usr/lib'中的回溯的一部分,而在那裏,另一部分在'/ usr/local/lib'中。這不應該真的發生。 – Evert

+0

這是在控制檯上顯示的唯一回溯。 –

回答

1

我能找到的唯一解決方案是重新安裝pip。終端

  • wget https://bootstrap.pypa.io/get-pip.py
  • sudo -H python get-pip.py --prefix=/usr/local/

然而上運行這些命令,這僅適用於pip,不pip3

1

升級你的setuptools: wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python3

通常合併執行sudo與PIP被認爲是有害的,避免這種情況,當你的系統是不是已經破碎。

+0

儘管我將setuptools升級到33.1.1,但「pip」不起作用 –

相關問題