方法一
安装setup-tools
linux-oz6w:~ # wget https://pypi.python.org/packages/source/s/setuptools/setuptools-11.3.tar.gz
linux-oz6w:~ # tar xf setuptools-11.3.tar.gz
linux-oz6w:~ # cd setuptools-11.3/
linux-oz6w:~ # python setup.py install
安装pip
linux-oz6w:~ # easy_install https://mirrors.aliyun.com/pypi/packages/0b/f5/be8e741434a4bf4ce5dbc235aa28ed0666178ea8986ddc10d035023744e6/pip-20.2.4.tar.gz#sha256=85c99a857ea0fb0aedf23833d9be5c40cf253fe24443f0829c7b472e23c364a1
..........
creating /usr/lib/python2.7/site-packages/pip-20.2.4-py2.7.egg
Extracting pip-20.2.4-py2.7.egg to /usr/lib/python2.7/site-packages
Adding pip 20.2.4 to easy-install.pth file
Installing pip script to /usr/bin
Installing pip2.7 script to /usr/bin
Installing pip2 script to /usr/bin
Installed /usr/lib/python2.7/site-packages/pip-20.2.4-py2.7.egg
Processing dependencies for pip==20.2.4
Finished processing dependencies for pip==20.2.4
# https://mirrors.aliyun.com/pypi/simple/pip/ 这是阿里云上面pip的tar包,python官方很多时候会受限,速度也不稳定,经常超时,没办法搞定
方法二
linux-oz6w:~ # wget https://github.com/imcxsen/python/blob/master/get_pip.py
linux-oz6w:~ # python 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.
Collecting pip
Downloading pip-20.3.1-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 3.5 MB/s
Collecting setuptools
Downloading setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
|████████████████████████████████| 583 kB 6.0 MB/s
Collecting wheel
Downloading wheel-0.36.0-py2.py3-none-any.whl (34 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-20.3.1 setuptools-44.1.1 wheel-0.36.0
配置阿里云pip源
linux-oz6w:~ # mkdir ~/.pip
linux-oz6w:~ # cat > ~/.pip/pip.conf << EOF
[global]
trusted-host=mirrors.aliyun.com
index-url=https://mirrors.aliyun.com/pypi/simple/
EOF
pip安装pyotp
linux-oz6w:~ # pip install pyotp
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://mirrors.aliyun.com/pypi/simple/
Collecting pyotp
Downloading https://mirrors.aliyun.com/pypi/packages/6f/5f/b8b985153df5516386e2918ab97ac836abfe88dc420cd3211d7b9e30814e/pyotp-2.4.1-py2.py3-none-any.whl (11 kB)
Installing collected packages: pyotp
Successfully installed pyotp-2.4.1 # 安装成功