一、pip指定国内镜像源

在单次安装中指定库

pip install selenium -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

配置全局pypi仓库

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

二、升级导致pip不可用的处理方法(pip降级)

在CentOS 7版本中自带的python版本为2.7。
pip版本在升级到21版本及以上时将不可用。

降级pip至20版本

wget https://bootstrap.pypa.io/2.7/get-pip.py
#下载get-pip.py

python get-pip.py
#运行下载的py

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
#pip-21版本在2021年1月停止支持Python2.7。
Collecting pip<21.0
  Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 510 kB/s 
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, wheel
  Attempting uninstall: pip
    Found existing installation: pip 21.0.1
    Uninstalling pip-21.0.1:
      Successfully uninstalled pip-21.0.1
Successfully installed pip-20.3.4 wheel-0.36.2
#pip-20安装完成

标签: Python

添加新评论