1. 程式人生 > >python3 與 pip3 安裝與使用

python3 與 pip3 安裝與使用

 

正文開始:

1. yum -y install openssl*  

(pip依賴ssl環境)

 

2.編譯安裝python3

下載地址:https://www.python.org/ftp/python/

1 tar zxvf Python-3.5.2.tgz
2 cd Python-3.5.2
3 ./configure
4 make && make install 
安裝步驟

 

3.安裝完成後預設就有pip3了.   4.安裝完成可以裝個模組試試 複製程式碼
1 [[email protected] Python-3.5.2]# pip3 install pymysql
2 Collecting pymysql
3   Downloading PyMySQL-0.7.9-py3-none-any.whl (78kB)
4     100% |████████████████████████████████| 81kB 6.3kB/s 
5 Installing collected packages: pymysql
6 Successfully installed pymysql-0.7.9
7 You are using pip version 8.1
.1, however version 9.0.1 is available. 8 You should consider upgrading via the 'pip install --upgrade pip' command.
複製程式碼

 上面提示有新版本了  可以升級.

使用它提示的命令就可以升級pip3了..

但是注意要把pip命令替換成pip3

複製程式碼
 1 [[email protected] Python-3.5.2]# pip3 install --upgrade pip
2 Collecting pip 3 Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 4 100% |████████████████████████████████| 1.3MB 3.2kB/s 5 Installing collected packages: pip 6 Found existing installation: pip 8.1.1 7 Uninstalling pip-8.1.1: 8 Successfully uninstalled pip-8.1.1 9 Successfully installed pip-9.0.1 10 [[email protected] Python-3.5.2]# pip3 --version 11 pip 9.0.1 from /usr/local/lib/python3.5/site-packages (python 3.5)
複製程式碼

升級完成

 

PS:

如果使用pip3安裝外掛的時候提示:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. 

是因為系統缺少openssl-devel包

yum install openssl-devel -y  安裝一下即可.

再按照上面的方法重新 編譯一下即可.

轉:https://www.cnblogs.com/wayde-Z/p/6086083.html