Python“ SSLError(”由于SSL模块不可用而无法连接到HTTPS URL。”)':/ simple / docutils /”

时间:2020-04-18 20:04:05

标签: python django ssl pip homebrew

问题

  • 无论我尝试从终端使用pip安装什么,我都会收到此错误消息
  • 我以前可能已经安装并完全删除了 homebrew (macOS 10.12),但不确定如何解决
  • Django 3.0应用运行良好

我尝试运行的安装(所有情况下的错误消息均相同)

pip install -r requirements.txt
pip install django-storages
pip install ssl

错误消息

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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-storages/
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-storages/
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-storages/
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-storages/
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-storages/
Could not fetch URL https://pypi.org/simple/django-storages/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/django-storages/ (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-storages (from versions: none)
ERROR: No matching distribution found for django-storages
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

尝试过的解决方案

1 个答案:

答案 0 :(得分:0)

https://stackoverflow.com/a/29969862/10270590

转到您的virtualenv目录(但不要运行workon):

cd ~/.virtualenv/name_of_broken_venv

现在删除这些文件:

rm -rf .Python bin/python* lib/python2.7/* include/python2.7

然后重建您的venv,运行:

virtualenv .
pip install -r requirements.txt