共計 3144 個字符,預(yù)計需要花費 8 分鐘才能閱讀完成。
行業(yè)資訊
服務(wù)器
ubuntu pip is configured with locations that require TLS/SSL 錯誤怎么解決
這篇文章主要介紹“ubuntu pip is configured with locations that require TLS/SSL 錯誤怎么解決”,在日常操作中,相信很多人在 ubuntu pip is configured with locations that require TLS/SSL 錯誤怎么解決問題上存在疑惑,丸趣 TV 小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”ubuntu pip is configured with locations that require TLS/SSL 錯誤怎么解決”的疑惑有所幫助!接下來,請跟著丸趣 TV 小編一起來學習吧!
背景:
ubuntu 14.04
python3.8
使用 pip install pymsql 提示錯誤:
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting django
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by SSLError(Can t connect to HTTPS URL because the SSL module is not available.) : /simple/django/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by SSLError(Can t connect to HTTPS URL because the SSL module is not available.) : /simple/django/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by SSLError(Can t connect to HTTPS URL because the SSL module is not available.) : /simple/django/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by SSLError(Can t connect to HTTPS URL because the SSL module is not available.) : /simple/django/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by SSLError(Can t connect to HTTPS URL because the SSL module is not available.) : /simple/django/
Could not fetch URL https://pypi.org/simple/django/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host= pypi.org , port=443): Max retries exceeded with url: /simple/django/ (Caused by SSLError( Can t connect to HTTPS URL because the SSL module is not available.)) - skipping
ERROR: Could not find a version that satisfies the requirement django (from versions: none)
ERROR: No matching distribution found for django
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host= pypi.org , port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError( Can t connect to HTTPS URL because the SSL module is not available.)) - skipping
原因:
因為 pip 安裝第三方庫需要 ssl 模塊,而 python 默認安裝 ssl 功能是不可用的
第一種解決方法:
解決辦法是重新編譯 python3 安裝文件,加上 –with-ssl 參數(shù)就可以讓 pip3 使用 ssl 功能了
# 重新編譯安裝
./configure --enable-optimizations --with-ssl
Ubuntu 16.04 安裝(install)python3.8
第二種解決方法:更換 pip 源
永久修改 pip 源
如果需要永久修改 pip 的軟件鏡像源,可以通過修改配置文件實現(xiàn)。
在 Linux 下,修改~/.pip/pip.conf,如果沒有則創(chuàng)建:
mkdir ~/.pip
vim ~/.pip/pip.conf
添加以下內(nèi)容
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
或者是:
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple/
[install]
use-mirrors = true
mirrors = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com
到此,關(guān)于“ubuntu pip is configured with locations that require TLS/SSL 錯誤怎么解決”的學習就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關(guān)知識,請繼續(xù)關(guān)注丸趣 TV 網(wǎng)站,丸趣 TV 小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>