python2升级更新pip出错

问题:
服务器版本没有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)

pip更新代码

pip install --upgrade pip

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

卸载

yum  remove  python-pip

如图所示

  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!

重装

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

下载包出错

参考 卸载 重装
使用20.3.4

    100% |████████████████████████████████| 2.2MB 368kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "", 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

你可能感兴趣的:(python,flask)