hi9a's blo9

こんにちは

Python3.7で SSLError

前回同様、Windows 10で Python3.7がうまく動かない話。

ポート443で requests.get() を試みると失敗します。

import requests
requests.get(url)
Traceback (most recent call last):  
File "C:\Users\me\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 588, in urlopen    conn = self._get_conn(timeout=pool_timeout)  
File "C:\Users\me\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 248, in _get_conn    return conn or self._new_conn()  
File "C:\Users\me\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 816, in _new_conn    raise SSLError("Can't connect to HTTPS URL because the SSL "urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

解決策

同様のことで困っている人がいました。

https://stackoverflow.com/questions/54135206/requests-caused-by-sslerrorcant-connect-to-https-url-because-the-ssl-module

にあるとおり、

https://slproweb.com/products/Win32OpenSSL.html

の、Win64 OpenSSL v1.1.1d Light をインストールしたら動作するようになりました。

質問サイトに助けられて満足しました。