centos6.5安裝python3.7.1之后無法使用pip的解決方案
編譯安裝全是坑……
第一遍裝完無法使用pip,報錯找不到ssl模塊。各種報錯:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
。。。
configure: error: Invalid --with-openssl value
。。。
結果各種搗鼓。
1、注意cetos6.5自帶的openssl版本是1.0.1,需要升級到1.0.2,升級完之后用openssl version檢查一下;
2、提前安裝好各種依賴包。yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ libffi-devel
3、./configure --prefix=/usr/local/python 之后,需要進到Modules里,修改Setup如下(一般升級完openssl,openssl默認就在/usr/local/ssl文件夾了):
# Socket module helper for socket(2)
_socket socketmodule.c
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
把這5行的注釋去掉。再進行make && make install,應該就能成功了。如果以前編譯失敗,記得把原來的Makefile文件刪除掉。
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對腳本之家的支持。如果你想了解更多相關內容請查看下面相關鏈接
相關文章
python3中的logging記錄日志實現過程及封裝成類的操作
這篇文章主要介紹了python3中的logging記錄日志實現過程及封裝成類的操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-05-05
python?解決?pip?時報錯?no?suchoption:?--bulid-dir?的解決辦法(最新
在使用PyCharm虛擬環(huán)境pip時,有時會遇到錯誤提示“no?such?option:?--build-dir”,這可能是由于pip版本不兼容或其他原因導致的,本文將詳細講解如何解決這個問題,感興趣的朋友跟隨小編一起看看吧2023-05-05

