Ubuntu20 安装 python2 的 pip

在Ubuntu20环境下,通过配置pip.conf、下载get-pip.py并设置代理(如果需要),成功安装了pip2。过程中提示Python2.7已达到生命周期终点,建议升级Python。安装完成后,pip2.0将不再支持Python2.7。
摘要由CSDN通过智能技术生成

Ubuntu20 安装 pip2

环境:ubuntu20, python2.7.18

1、配置 pip.conf(如果网络 ok,这一步省略)

root@myserver:~# cat /etc/pip.conf 
# BEGIN ANSIBLE MANAGED BLOCK
[global]
# END ANSIBLE MANAGED BLOCK
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

2、下载 pip-get

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py

3、如果需要代理,使用下面的 HTTPS_PROXY/https_proxy

export HTTPS_PROXY=http://192.168.1.1:3128
export https_proxy=http://192.168.1.1:3128

不要使用

export HTTPS_PROXY=https://192.168.1.1:3128
export https_proxy=https://192.168.1.1:3128

4、安装 pip2

root@myserver:~# python2 get-pip.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.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip<21.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/27/79/8a850fe3496446ff0d584327ae44e7500daf6764ca1a382d2d02789accf7/pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |################################| 1.5 MB 5.3 MB/s 
Collecting setuptools<45
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e1/b7/182161210a13158cd3ccc41ee19aadef54496b74f2817cc147006ec932b4/setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
     |################################| 583 kB 3.0 MB/s 
Collecting wheel
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-20.3.4 setuptools-44.1.1 wheel-0.36.2

参考文章

https://stackoverflow.com/questions/56628194/sslerror-installing-with-pip

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值