【发布时间】:2020-08-01 08:41:55
【问题描述】:
问题
- 无论我尝试使用 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
尝试过的解决方案
- https://stackoverflow.com/a/59280089/10270590
- pip TLS/SSL, however the ssl module in Python is not available problem
- pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
- @hoefling https://stackoverflow.com/users/2650249/hoefling 推荐运行:
python -c "import _ssl"- 结果:
dyld: Library not loaded: @executable_path/../.Python Referenced from: /Users/..../django_app_mainfolder/ven/bin/python Reason: image not found Abort trap: 6 - 推荐解决方案:Broken references in Virtualenvs
- 我在这里查看主要答案,但我不知道发生了什么https://stackoverflow.com/a/25947333/10270590 = This is the origin of the answer
- 无效 - https://stackoverflow.com/a/23660033/10270590
- 不可用 - 我现在不使用 brew - https://stackoverflow.com/a/51145074/10270590
- 结果:
【问题讨论】:
-
你试过this吗?好像是图书馆的问题。除此之外,请尝试重新安装 Python
-
我不知道为什么我的 cmets 被删除了,所以我再重复一遍:导入
_ssl模块时出现错误,所以要么你的虚拟环境(如果你使用一个)甚至你的 python 安装很糟糕你可以通过尝试在虚拟环境之外导入_ssl来检查。因此问题又来了——你是如何安装 python 的?你是如何创建虚拟环境的? -
另一件事——不要做
pip install ssl,它是标准库的一部分,安装第三方ssl在最好的情况下不会带来任何东西,在最坏的情况下会导致更多的错误。跨度> -
我不得不删除我的问题,因为我已经用一些敏感信息更新了我的问题,抱歉。 @hoefling 只是发布这个,我接受你的回答stackoverflow.com/a/29969862/10270590
标签: python django ssl pip homebrew