この記事の内容
djangoをインストールすると何やら怪しげなエラーThere was a problem confirming the ssl certificateがでたので備忘として記載します。
目次
1.環境
2.エラー内容
3.解決方法
1.環境
Windows 10
Python 3.7.8
2.エラー内容
djangoをインストールしようとしたら下記のような怪しげなwarningが出てきました。
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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=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 SSLErrERROR: Could not find a version that satisfies the requirement django (from versions: none)
ERROR: No matching distribution found for django
調べてみるといくつか解決方法が書かれていましたが、一番簡単そうな「Pythonのバージョンをアップデートする」という方法をとりあえず採用しました。
3.解決方法
Pythonサイトで最新の3.8.4 (https://www.python.org/downloads/release/python-384/) をインストールします。
すると、
Collecting django
Downloading Django-3.0.8-py3-none-any.whl (7.5 MB)
|████████████████████████████████| 7.5 MB ...
Collecting pytz
Downloading pytz-2020.1-py2.py3-none-any.whl (510 kB)
|████████████████████████████████| 510 kB ...
Collecting asgiref~=3.2
Downloading asgiref-3.2.10-py3-none-any.whl (19 kB)
Collecting sqlparse>=0.2.2
Downloading sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
|████████████████████████████████| 40 kB ...
Installing collected packages: pytz, asgiref, sqlparse, django
Successfully installed asgiref-3.2.10 django-3.0.8 pytz-2020.1 sqlparse-0.3.1
成功しました。
