升级到ubuntu-16.10后,点子不起作用 [英] Pip does not work after upgrade to ubuntu-16.10

查看:66
本文介绍了升级到ubuntu-16.10后,点子不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与pip一起运行命令会出现以下错误.甚至命令 pip -V 也会产生以下错误.
我读到该错误是由于setuptools版本31.0.0而引起的,它应低于28.0.0.但是我的setuptools版本是26.1.1,它仍然给出相同的错误.

Running a command alongwith pip gives the following error. Even the command pip -V produces the following error.
I read that the error is due to setuptools version 31.0.0 and it should be lower than 28.0.0. But the version of my setuptools is 26.1.1 and it still gives the same error.


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'

推荐答案

我能找到的唯一解决方案是重新安装pip.在终端上运行这些命令

The only solution I could find is reinstalling pip. Run these commands on your terminal

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

但是,这仅适用于pip,不适用于pip3

However, this works only for pip, not pip3!

这篇关于升级到ubuntu-16.10后,点子不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆