pip install 报错

Posted sihye

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pip install 报错相关的知识,希望对你有一定的参考价值。

前景,pymysql,pysftp这类库已经pip install 但运行脚本时还是提示没有模块
于是
pip install --upgrade pip 升级了一下
然后再次pip时就出现了一堆报错

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2795, in _dep_map
    return self.__dep_map
  File "/usr/local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2652, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/pip/basecommand.py", line 211, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.5/site-packages/pip/commands/install.py", line 294, in run
    requirement_set.prepare_files(finder)
  File "/usr/local/lib/python3.5/site-packages/pip/req/req_set.py", line 334, in prepare_files
    functools.partial(self._prepare_file, finder))
  File "/usr/local/lib/python3.5/site-packages/pip/req/req_set.py", line 321, i
 ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"‘"‘/tmp/pip-install-f3uSbo/subprocess32/setup.py‘"‘"‘; __file__=‘"‘"‘/tmp/pip-install-f3uSbo/subprocess32/setup.py‘"‘"‘;f=getattr(tokenize, ‘"‘"‘open‘"‘"‘, open)(__file__);code=f.read().replace(‘"‘"‘
‘"‘"‘, ‘"‘"‘
‘"‘"‘);f.close();exec(compile(code, __file__, ‘"‘"‘exec‘"‘"‘))‘ egg_info --egg-base /tmp/pip-install-f3uSbo/subprocess32/pip-egg-info
         cwd: /tmp/pip-install-f3uSbo/subprocess32/
    Complete output (19 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-f3uSbo/subprocess32/setup.py", line 120, in <module>
        main()
      File "/tmp/pip-install-f3uSbo/subprocess32/setup.py", line 114, in main
        ‘Programming Language :: Python :: Implementation :: CPython‘,
      File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 269, in __init__
        _Distribution.__init__(self,attrs)
      File "/usr/lib64/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 302, in finalize_options
        ep.load()(self, ep.name, value)
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2316, in load
        return self.resolve()
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2326, in resolve
        raise ImportError(str(exc))
    ImportError: ‘module‘ object has no attribute ‘check_specifier‘
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs 

处理办法: 升级库

python -m pip install --upgrade setuptools
pip install matplotlib --upgrade
# 升级后再去pip isntall 就不再报错
pip3 install pysftp



以上是关于pip install 报错的主要内容,如果未能解决你的问题,请参考以下文章

python 的pip install 安装包报错。

Python用pip install安装Scipy报错

pip install -U selenium 报错为啥呢?

python -m pip install --upgrade pip 更新一直报错

python pip install XXX出现报错问题

pip3.7 install报错bad interpreter: No such file or directory