1. 程式人生 > >解壓版Python3.6.4安裝,配置解壓包中自帶的pip3

解壓版Python3.6.4安裝,配置解壓包中自帶的pip3

純手打,轉載務請附上本文網址!!!

樓主是在/usr/local目錄下進行操作的,所以需要root進行

先說Python3.6.4的安裝

首先呢,你需要下載Python3.6.4的資源包,樓主的系統時linux 64位的

sudo wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz

下載完成之後解壓

sudo tar -xvf Python-3.6.4.tgz

再進行以下步驟,就基本算完成了

./configure --with-ssl
sudo make
sudo make install

這裡的第一句./configure --with-ssl一定不能掉,否則安裝完成之後pip3 install的時候很有可能會出現問題

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.Could not fetch URL https:*******: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skippingpip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Could not fetch URL https:*******: There was a problem confirming the ssl certificate: 
Can't connect to HTTPS URL because the SSL module is not available. - skipping

最後在/usr/bin目錄中建立硬連結

ln -s /usr/local/python3.6.4/bin/python3 /usr/bin/python3.6

在終端中輸入python3.6,看到如下便表示Python3.6.4安裝成功了

再說Python3.6.4中pip3的配置

接下來是Python3.6.4中pip3的配置,為什麼要用其中的pip3呢,因為系統中預設的是Python2的環境,pip install安裝到的是Python2的環境中,不是你現在裝的Python3.6.4的環境

另外說一點:記住千萬不要去改這個Python2和系統自帶的別的Python的環境,系統有很多命令是依賴於自帶的Python環境,如果不是很瞭解千萬就別去改這些東西

sudo ln -s /usr/local/python3.6.4/bin/pip3 /usr/bin/pip3

開啟終端,輸入pip3 -V,看到以下畫面表示安裝成功

最後說一句使用pip3安裝推薦使用以下命令哦

sudo -H pip3 install  XXXXXX