安装pip3,pip3安装,pip共存
一、安装setuptools
1) 到页面(https://pypi.org/project/setuptools/#files)查找最新版本链接,下载,解压。
0 1 |
# wget --no-check-certificate https://files.pythonhosted.org/packages/c2/f7/c7b501b783e5a74cf1768bc174ee4fb0a8a6ee5af6afa92274ff964703e0/setuptools-40.8.0.zip # unzip setuptools-40.8.0.zip |
2) 构建安装
0 1 2 |
# cd setuptools-40.8.0 # python3 setup.py build # python3 setup.py install |
二、安装pip3
1) 到页面(https://pypi.org/project/pip/#files)查找最新版本链接,下载解压。
0 1 |
wget --no-check-certificate https://files.pythonhosted.org/packages/36/fa/51ca4d57392e2f69397cd6e5af23da2a8d37884a605f9e3f2d3bfdc48397/pip-19.0.3.tar.gz tar -zxvf pip-19.0.3 |
2) 构建安装
0 1 2 |
cd pip-19.0.3 python3 setup.py build python3 setup.py install |
三、测试pip3是否安装成功
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# python3 Python 3.6.4 (default, Jan 5 2018, 02:13:53) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pymysql Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'pymysql' >>> exit() # pip3 install pymysql Collecting pymysql Downloading https://files.pythonhosted.org/packages/ed/39/15045ae46f2a123019aa968dfcba0396c161c20f855f11dea6796bcaae95/PyMySQL-0.9.3-py2.py3-none-any.whl (47kB) 100% |████████████████████████████████| 51kB 120kB/s Installing collected packages: pymysql Successfully installed pymysql-0.9.3 # python3 Python 3.6.4 (default, Jan 5 2018, 02:13:53) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pymysql >>> |
这就表示安装成功。