Python "SSLError("SSL モジュールが使用できないため HTTPS URL に接続できません。")': /simple/docutils/"

Python

質問

  • pip(macOS 10.12)を使用して端末に何をインストールしようとすると、このエラーメッセージが表示されます。
  • インストールして完全に削除した可能性があります。自家製以前は、この問題を解決する方法がわかりませんでした。

私が実行したインストール(すべての場合で同じエラーメッセージ)

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

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

おすすめ記事