本文研究记录了 Linux 下安装 pip 的全部方法.
Installing pip/setuptools/wheel with Linux Package Managers 列出了绝大多数常见 Linux 发行版使用包管理工具安装 pip 的方法. 更多有关 python 包管理的内容点击 Python Packaging User Guide.
根据我的经验和研究,Linux 系统包管理工具安装 pip 存在很多兼容性问题. 最好使用第 2. 节介绍的源码方式安装 pip.
Debian / Ubuntu 等系统可以使用 apt 包管理工具安装 pip. 但是 apt 只提供 8.1.1 版本. 这个版本非常老旧,需要升级到最新版本才能方便使用.
下面以 Ubuntu16.04 为例记录通过 apt 工具安装升级 pip 的过程. Ubuntu16.04 系统自带 python2.7 和 python3.5,使用 deadsnakes 源安装了 python3.6.
$ sudo apt-get install python-pip python3-pip
如果不关心细节,可以略过以下的研究内容,直接阅读第 1.2 小节升级 pip 到最新版本.
安装路径为/usr/bin/
.
$ ll /usr/bin/ | grep pip | grep -v l
-rwxr-xr-x 1 root root 292 11月 10 2016 pip*
-rwxr-xr-x 1 root root 283 11月 10 2016 pip2*
-rwxr-xr-x 1 root root 293 11月 10 2016 pip3*
pip
和 pip2
在 python-pip
包内.pip3
在 python3-pip
包内.查看版本,为 8.1.1. 这是非常老的版本. 10.0 版本有重大升级,不与旧版本兼容.
$ pip -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
$ pip2 -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
$ pip3 -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
这三个可执行文件其实都是 python 脚本.
查看 pip
.
$ cat /usr/bin/pip
#!/usr/bin/python
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
sys.exit(main())
查看 pip2
.
$ cat /usr/bin/pip2
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==8.1.1','console_scripts','pip2'
__requires__ = 'pip==8.1.1'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pip==8.1.1', 'console_scripts', 'pip2')()
)
查看 pip3
.
$ cat /usr/bin/pip
#!/usr/bin/python3
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
sys.exit(main())
说明:
pip
和 pip3
仅行首不同,也就是默认的 python 解释器不同pip2
使用了 pkg_resources
,而另外 2 个没有通过 apt 包管理工具安装实际上是将 setuptools (20.7.0)
、pip (8.1.1)
、wheel (0.29.0)
安装到系统 python 的默认包管理路径.
$ pip list
...
pip (8.1.1)
...
setuptools (20.7.0)
...
wheel (0.29.0)
...
$ pip3 list
...
pip (8.1.1)
...
setuptools (20.7.0)
...
wheel (0.29.0)
...
其它 python3.x 版本也可以调用 pip.
$ python3.6 -m pip -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.6)
如果需要其它版本 python 使用 pip,使用如上调用方法. 不要修改 pip 可执行文件的行首去指定 python 解释器.
使用 sudo -H
将升级的版本安装到系统路径 /usr/local/lib
下.
升级 pip
.
$ sudo -H pip install -U pip
使用 -i
参数指定镜像源,提高下载速度.
$ sudo -H pip install -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 1.2MB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-20.2.2
注意,升级时没有卸载 /usr/lib/python2.7/dist-packages
的 8.1.1 版本,将新版本安装到了 /usr/local/lib/python2.7/dist-packages
.
查看版本,pip
和 pip2
命令已经升级.
$ pip -V
pip 20.2.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ pip2 -V
pip 20.2.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ pip3 -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
继续升级 pip3
.
$ sudo -H pip3 install -U pip
同样指定镜像源加速.
$ sudo -H pip3 install -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 1.3MB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed pip-20.2.2
注意,升级时没有卸载 /usr/lib/python3/dist-packages
的 8.1.1 版本,将新版本安装到了 /usr/local/lib/python3.5/dist-packages
.
$ pip3 -V
pip 20.2.2 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
此时调用的 pip 脚本在 /usr/local/bin
下.
$ which pip
/usr/local/bin/pip
$ which pip2
/usr/local/bin/pip2
$ which pip3
/usr/local/bin/pip3
但是原来的 8.1.1 版本并没有被卸载,因为 /usr/bin
目录下的 pip 脚本依然存在.
$ /usr/bin/pip -V
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 20.2.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
调用 /usr/bin
目录下的 pip 脚本则会告警. 告警信息提示为了避免 pip 版本不兼容和调用错误,不要直接使用 pip
命令,而是使用 python -m pip
的方式调用 pip. 详情可见 issue5599. 第 1.3 小节将简单说相关内容.
使用 python3.5 通过 -m pip
方式调用 pip. 被调用的是最新安装的 20.2.2 版本.
$ python3.5 -m pip -V
pip 20.2.2 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
使用 python3.6 通过 -m pip
方式调用 pip. 被调用的却是旧的 8.1.1 版本.
$ python3.6 -m pip -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.6)
这是因为升级的 20.2.2 版本被安装在 /usr/local/lib/python3.5/dist-packages
目录下. 这是 python3.5 的第三方库文件存储路径. 而 8.1.1 版本被安装在 /usr/lib/python3/dist-packages
目录下,这是系统 python3.x 的库文件路径,也就是说任何系统全局的 python3.x 都能调用该目录下的库. 与此同时,python3.6 的包存储路径 /usr/local/lib/python3.6/dist-packages
下还未安装 pip. 因而此时 python3.6 调用的是 pip 8.1.1 版本.
为 python3.6 升级 pip.
$ sudo -H python3.6 -m pip install -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
$ python3.6 -m pip -V
pip 20.2.2 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
查看 pip 可执行文件.
$ ll /usr/local/bin/ | grep pip
-rwxr-xr-x 1 root root 226 9月 5 17:07 pip*
-rwxr-xr-x 1 root root 223 9月 5 16:48 pip2*
-rwxr-xr-x 1 root root 223 9月 5 16:48 pip2.7*
-rwxr-xr-x 1 root root 226 9月 5 17:07 pip3*
-rwxr-xr-x 1 root root 224 9月 5 16:52 pip3.5*
-rwxr-xr-x 1 root root 226 9月 5 17:07 pip3.6*
查看调用的 python 版本
$ pip -V
pip 20.2.2 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
$ pip2 -V
pip 20.2.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ pip2.7 -V
pip 20.2.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ pip3 -V
pip 20.2.2 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
$ pip3.5 -V
pip 20.2.2 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
$ pip3.6 -V
pip 20.2.2 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
需要注意,在 /usr/bin/pip
升级而 /usr/bin/pip3
还未升级时,/usr/local/bin/pip
使用 python2.7 调用. 在 /usr/bin/pip3
升级后,/usr/local/bin/pip
和 /usr/local/bin/pip3
使用 python3.5 调用. 而在 python3.6 -m pip
升级后,/usr/local/bin/pip
和 /usr/local/bin/pip3
又都变成使用 python3.6 调用.
也就是说,/usr/local/bin/pip
和 /usr/local/bin/pip3
的默认 python 版本会由于升级改变. 其实是这些可执行脚本的默认解释器被修改.
$ cat /usr/local/bin/pip
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
手动修改 pip 可执行脚本的行首指定 python 版本会带来版本管理的混乱. 最好通过 pythonX.x -m pip
或 pipX.x
的方式指定 python 版本.
也可以使用--user
选项将升级的 pip 安装到用户路径 ~/.local/lib/pythonX.x/site-packages
.
升级 python2.7 的 pip.
$ pip install --user -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
$ pip -V
pip 20.2.2 from /home/localhost/.local/lib/python2.7/site-packages/pip (python 2.7)
升级 python3.5 的 pip.
$ pip3 install --user -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
$ pip3 -V
pip 20.2.2 from /home/localhost/.local/lib/python3.5/site-packages/pip (python 3.5)
$ python3.6 -m pip -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.6)
升级 python3.6 的 pip.
$ python3.6 -m pip install --user -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
$ python3.6 -m pip -V
pip 20.2.2 from /home/localhost/.local/lib/python3.6/site-packages/pip (python 3.6)
可执行 pip 脚本在 ~/.local/bin
目录下.
$ ll ~/.local/bin/
total 32
drwxrwxr-x 2 localhost localhost 4096 9月 5 16:11 ./
drwx------ 5 localhost localhost 4096 9月 5 16:08 ../
-rwxrwxr-x 1 localhost localhost 226 9月 5 16:11 pip*
-rwxrwxr-x 1 localhost localhost 223 9月 5 16:08 pip2*
-rwxrwxr-x 1 localhost localhost 223 9月 5 16:08 pip2.7*
-rwxrwxr-x 1 localhost localhost 226 9月 5 16:11 pip3*
-rwxrwxr-x 1 localhost localhost 224 9月 5 16:09 pip3.5*
-rwxrwxr-x 1 localhost localhost 226 9月 5 16:11 pip3.6*
$ cat ~/.local/bin/pip
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
如果安装 2.0 版本以前的 pip,例如 19.3.1 版本,会遇到 issue5599 中所描述的 bug.
$ sudo -H pip install -U "pip<20" -i https://pypi.tuna.tsinghua.edu.cn/simple
[sudo] password for localhost:
Collecting pip<20
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 273kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-19.3.1
$ pip -V
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
这是因为 pip>=10.0 后,可执行脚本文件出现改动.,但是在升级时不会升级可执行 pip 脚本文件的内容. 在 2.0 版本开始修复这个 bug,将升级的可执行 pip 脚本文件放在 /usr/local/bin
下,和 /usr/bin
下的旧脚本区分开来.
编辑/usr/bin/pip
文件可以修复这个 bug.
from pip._internal import main
保存退出.
$ pip -V
pip 19.3.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
$ sudo -H pip3 install -U "pip<20" -i https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip<20
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 1.3MB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed pip-19.3.1
$ pip3 -V
pip 19.3.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
$ python3.6 -m pip -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.6)
sudo -H python3.6 -m pip install -U "pip<20" -i https://pypi.tuna.tsinghua.edu.cn/simple
$ python3.6 -m pip -V
pip 19.3.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
issue5599 充分说明在 Debian 系统及衍生发行版上通过 apt 安装升级 pip 存在非常多的问题. 新旧 pip 版本不兼容和 python 多版本混淆使得 python 包的管理非常容易出错. 因此建议大家使用第 3 节介绍的源码安装 pip 的方式.
待续
强烈建议使用 2.1 或 2.4 小节所述方法安装 pip.
通过 get-pip.py 脚本文件在线安装 pip 是官方教程的方法. 也是我十分推荐的方式,灵活便捷、简单好用.
使用 curl
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
或者 wget
$ wget -c https://bootstrap.pypa.io/get-pip.py
下载 get-pip.py
脚本.
由于网络原因可能使得下载速度非常慢. 可以在 Windows 打开网页复制代码到文件中,或者使用下载工具下载. 然后使用 ftp 工具上传到 Ubuntu.
查看使用帮助.
$ python3.6 get-pip.py --help
为 python3.6 安装最新版本 pip.
使用 sudo -H
安装到系统路径.
$ sudo -H python3.6 get-pip.py install -i https://pypi.tuna.tsinghua.edu.cn/simple
$ sudo -H python3.6 get-pip.py install -i https://pypi.tuna.tsinghua.edu.cn/simple
[sudo] password for localhost:
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting install
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/41/cf/e3e6b4d494051c07261cae8c403f0f0d0cedad43d980e5255f2c88fd5edf/install-1.3.3-py3-none-any.whl (3.1 kB)
Collecting pip
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 2.2 MB/s
Collecting setuptools
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/7d/53/cd47a7799c5e82de7e408fecd72266dcc6cd7be32629b6022d4d6d91a2fc/setuptools-50.2.0-py3-none-any.whl (784 kB)
|████████████████████████████████| 784 kB 21.2 MB/s
Collecting wheel
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a7/00/3df031b3ecd5444d572141321537080b40c1c25e1caa3d86cdd12e5e919c/wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Installing collected packages: install, pip, setuptools, wheel
Successfully installed install-1.3.3 pip-20.2.2 setuptools-50.2.0 wheel-0.35.1
$ pip -V
pip 20.2.2 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
使用 --user
选项则安装到用户路径.
$ python3.6 get-pip.py install --user -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting install
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/41/cf/e3e6b4d494051c07261cae8c403f0f0d0cedad43d980e5255f2c88fd5edf/install-1.3.3-py3-none-any.whl (3.1 kB)
Collecting pip
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 2.4 MB/s
Collecting setuptools
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/44/a6/7fb6e8b3f4a6051e72e4e2218889351f0ee484b9ee17e995f5ccff780300/setuptools-50.3.0-py3-none-any.whl (785 kB)
|████████████████████████████████| 785 kB 14.0 MB/s
Collecting wheel
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a7/00/3df031b3ecd5444d572141321537080b40c1c25e1caa3d86cdd12e5e919c/wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Installing collected packages: install, pip, setuptools, wheel
Successfully installed install-1.3.3 pip-20.2.2 setuptools-50.3.0 wheel-0.35.1
$ pip -V
pip 20.2.2 from /home/localhost/.local/lib/python3.6/site-packages/pip (python 3.6)
get-pip.py
实际上是在线安装 setuptools
、pip
、wheel
三个包.
ez_setup.py 用来在线安装 easy_install 和 setuptools. ez_setup.py
在 setuptools 33.1.1版本被废弃.
下载 ez_setup.py
文件.
$ curl https://bootstrap.pypa.io/ez_setup.py -o ez_setup.py
$ wget -c https://bootstrap.pypa.io/ez_setup.py
查看使用帮助.
$ python ez_setup.py --help
ez_setup.py is deprecated and when using it setuptools will be pinned to 33.1.1 since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools
Usage: ez_setup.py [options]
Options:
-h, --help show this help message and exit
--user install in user site package
--download-base=URL alternative URL from where to download the setuptools
package
--insecure Use internal, non-validating downloader
--version=VERSION Specify which version to download
--to-dir=TO_DIR Directory to save (and re-use) package
为 python3.6 安装 easy_install 和 setuptools.
$ sudo -H python3.6 ez_setup.py
查看版本.
$ easy_install --version
setuptools 33.1.1 from /usr/local/lib/python3.6/dist-packages/setuptools-33.1.1-py3.6.egg (Python 3.6)
$ ll /usr/local/bin/ | grep easy_install
-rwxr-xr-x 1 root root 406 9月 5 16:09 easy_install*
-rwxr-xr-x 1 root root 414 9月 5 16:09 easy_install-3.6*
/usr/local/bin/easy_install
也是可执行 python 脚本.
$ cat /usr/local/bin/easy_install
#!/usr/bin/python3.6
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==33.1.1','console_scripts','easy_install'
__requires__ = 'setuptools==33.1.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('setuptools==33.1.1', 'console_scripts', 'easy_install')()
)
为 python3.6 安装 pip.
$ sudo -H easy_install pip
使用 -i
指定镜像源.
$ sudo -H easy_install -i https://pypi.tuna.tsinghua.edu.cn/simple pip
$ pip -V
pip 20.2.2 from /usr/local/lib/python3.6/dist-packages/pip-20.2.2-py3.6.egg/pip (python 3.6)
升级 setuptools.
$ sudo -H easy_install -U -i https://pypi.tuna.tsinghua.edu.cn/simple setuptools
或者
$ sudo -H pip install setuptools -U -i https://pypi.tuna.tsinghua.edu.cn/simple
查看版本.
$ easy_install --version
setuptools 50.3.0 from /usr/local/lib/python3.6/dist-packages/setuptools-50.3.0-py3.6.egg (Python 3.6)
安装 wheel.
$ sudo -H pip install wheel -i https://pypi.tuna.tsinghua.edu.cn/simple
easy_install 是 setuptools 包里的一个模块,用于管理 python 包. 源码安装 setuptools 就能安装 easy_install 工具. ez_setup.py 脚本实质上是将这个过程自动化了.
$ wget -c https://files.pythonhosted.org/packages/7c/1b/9b68465658cda69f33c31c4dbd511ac5648835680ea8de87ce05c81f95bf/setuptools-50.3.0.zip
$ unzip setuptools-50.3.0.zip
$ cd setuptools-50.3.0
$ sudo -H python3.6 setup.py install
$ easy_install --version
setuptools 50.3.0 from /usr/local/lib/python3.6/dist-packages/setuptools-50.3.0-py3.6.egg (Python 3.6)
$ which easy_install
/usr/local/bin/easy_install
$ sudo -H easy_install -i https://pypi.tuna.tsinghua.edu.cn/simple pip
$ pip -V
pip 20.2.2 from /usr/local/lib/python3.6/dist-packages/pip-20.2.2-py3.6.egg/pip (python 3.6)
安装 wheel.
$ sudo -H pip install wheel -i https://pypi.tuna.tsinghua.edu.cn/simple
pip 依赖于 setuptools,wheel 完善了 pip 的包管理功能. 而 get-pip.py 脚本的作用其实就是下载安装这三个包.
因而最本质的方法就是从 setuptools、pip、wheel 的下载安装源码包.
这个方法最朴素最简单,并且可以离线安装.
下载安装 setuptools
$ cd ~/Downloads
$ wget -c https://files.pythonhosted.org/packages/7c/1b/9b68465658cda69f33c31c4dbd511ac5648835680ea8de87ce05c81f95bf/setuptools-50.3.0.zip
$ unzip setuptools-50.3.0.zip
$ cd setuptools-50.3.0/
$ sudo -H python3.6 setup.py install
下载安装 pip
$ cd ~/Downloads
$ wget -c https://files.pythonhosted.org/packages/73/8e/7774190ac616c69194688ffce7c1b2a097749792fea42e390e7ddfdef8bc/pip-20.2.2.tar.gz
$ tar -xzvf pip-20.2.2.tar.gz
$ cd pip-20.2.2/
$ sudo -H python3.6 setup.py install
下载安装 wheel
$ cd ~/Downloads
$ wget -c https://files.pythonhosted.org/packages/83/72/611c121b6bd15479cb62f1a425b2e3372e121b324228df28e64cc28b01c2/wheel-0.35.1.tar.gz
tar -xzvf wheel-0.35.1.tar.gz
$ cd wheel-0.35.1/
$ sudo -H python3.6 setup.py install