当前位置:   article > 正文

python2升级更新pip出错_package python2-pip-8.1.2-14.el7.noarch already in

package python2-pip-8.1.2-14.el7.noarch already installed and latest version

问题:
服务器版本没有pip,下载pip之后,更新版本报错
只好卸载pip,再次重装,不更新,版本不出错,下载flask,报错
再次卸载pip,更新到20.3.4,下载flask 不报错

pip版本

pip -V # pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
  • 1

pip更新代码

pip install --upgrade pip
  • 1

pip 报错信息

Traceback (most recent call last):
  File "/bin/pip", line 9, in <module>
    load_entry_point('pip==21.1.2', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named typing

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

卸载

yum  remove  python-pip
  • 1

如图所示

  Verifying  : shm-release-1-1.x86_64                                                                                                                                                                     1/2
  Verifying  : python2-pip-8.1.2-14.el7.noarch                                                                                                                                                            2/2
Removed:
  python2-pip.noarch 0:8.1.2-14.el7
Dependency Removed:
  shm-release.x86_64 0:1-1
Complete!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

重装

yum -y install epel-release # 安装epel-release
yum -y install python-pip # 安装python-pip
pip install --upgrade pip==20.3.4 # 升级pip
  • 1
  • 2
  • 3

下载包出错

参考 卸载 重装
使用20.3.4

    100% |████████████████████████████████| 2.2MB 368kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "setuptools/__init__.py", line 16, in <module>
        import setuptools.version
      File "setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "pkg_resources/__init__.py", line 1367
        raise SyntaxError(e) from e
                                ^
    SyntaxError: invalid syntax

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/581370
推荐阅读
相关标签
  

闽ICP备14008679号