$wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py # 运行安装脚本
注意:用哪个版本的 Python 运行安装脚本,pip 就被关联到哪个版本,如果是 Python3 则执行以下命令:
$ sudo python3 get-pip.py # 运行安装脚本。
一般情况 pip 对应的是 Python 2.7,pip3 对应的是 Python 3.x
如果显示
root@66b6f8945ca1:/# python get-pip.py
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-p
y2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 1.8MB/s
Installing collected packages: pip
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Successfully installed pip-18.1