https://blog.csdn.net/zhangfeng888168/article/details/89963331
********************************************************************************
import requests url = 'https://caijing.chinadaily.com.cn/a/202001/14/WS5e1d6deca3107bb6b5799df6.html' r = requests.get(url, allow_redirects=False, verify=False)

Traceback (most recent call last):
File "D:installsoftAnaconda3libsite-packagesurllib3connectionpool.py", line 588, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "D:installsoftAnaconda3libsite-packagesurllib3connectionpool.py", line 248, in _get_conn
return conn or self._new_conn()
File "D:installsoftAnaconda3libsite-packagesurllib3connectionpool.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.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:installsoftAnaconda3libsite-packages
equestsadapters.py", line 449, in send
timeout=timeout
File "D:installsoftAnaconda3libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "D:installsoftAnaconda3libsite-packagesurllib3util
etry.py", line398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='caijing.chinadaily.com.cn', port=443): Max retries exceeded with url: /a/202001/14/WS5e1d6deca3107bb6b5799df6.html (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:installsoftAnaconda3libsite-packages
equestsapi.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "D:installsoftAnaconda3libsite-packages
equestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "D:installsoftAnaconda3libsite-packages
equestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "D:installsoftAnaconda3libsite-packages
equestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "D:installsoftAnaconda3libsite-packages
equestsadapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='caijing.chinadaily.com.cn', port=443): Max retries exceeded with url: /a/202001/14/WS5e1d6deca3107bb6b5799df6.html (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
提示找不到_ssl模块。用 pip install ssl 语句也无法安装。
原因:
是环境变量的问题!
D:Anaconda3;
D:Anaconda3Scripts;
D:Anaconda3Libraryin
要添加三个环境变量,而不是只添加Scripts那个!