代码如下
import requests
print(requests.get("https://www.baidu.com"))
错误提示如下,是什么原因造成的
Traceback (most recent call last):
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/urllib3/connectionpool.py", line 588, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/urllib3/connectionpool.py", line 250, in _get_conn
return conn or self._new_conn()
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/urllib3/connectionpool.py", line 821, 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 "/Users/jiangyd/PycharmProjects/untitled10/mm.py", line 12, in <module>
print(requests.get("https://www.baidu.com"))
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/Users/jiangyd/python3_zy/lib/python3.6/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.
您好,请安装ssl相关模块(Py3)
pip install pyopenssl
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。