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:\installsoft\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 588, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "D:\installsoft\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 248, in _get_conn
return conn or self._new_conn()
File "D:\installsoft\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.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\installsoft\Anaconda3\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "D:\installsoft\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "D:\installsoft\Anaconda3\lib\site-packages\urllib3\util\retry.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:\installsoft\Anaconda3\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "D:\installsoft\Anaconda3\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "D:\installsoft\Anaconda3\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "D:\installsoft\Anaconda3\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "D:\installsoft\Anaconda3\lib\site-packages\requests\adapters.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:\Anaconda3\Scripts;
D:\Anaconda3\Library\bin
要添加三個環境變量,而不是只添加Scripts那個!
