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('"'"'\r\n'"'"', '"'"'\n'"'"');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
posted @ 2020-04-05 10:54  sihte  阅读(962)  评论(0编辑  收藏  举报