1)通過源碼編譯安裝需要依賴gcc,zlib等包。可通過yum安裝
yum install gcc zlib*
2)此外,pip依賴ssl環境,所以還需要先安裝openssl相關的依賴
yum install openssl*
3)從官網下載python3源碼包之後,然後解壓,進入解壓目錄執行以下命令:
./configure
make
make install
編譯安裝完成之後,pip3也一起安裝了。
注意:如果make&&make install 之後發現使用pip3時報如下錯誤:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
說明在make&&make install編譯安裝之前,環境缺少openssl依賴。安照2)安裝之後,再make&&make install編譯安裝一次。