Python Linux上的Jupyter:URLError:<;urlopen错误[SSL:证书\u验证\u失败]证书验证失败
我目前正在学习如何使用熊猫库的教程,我可以克服这个错误。我对整个场景还是新手,所以我不完全确定到底发生了什么或者如何解释这个错误:Python Linux上的Jupyter:URLError:<;urlopen错误[SSL:证书\u验证\u失败]证书验证失败,python,ssl-certificate,Python,Ssl Certificate,我目前正在学习如何使用熊猫库的教程,我可以克服这个错误。我对整个场景还是新手,所以我不完全确定到底发生了什么或者如何解释这个错误: --------------------------------------------------------------------------- SSLCertVerificationError Traceback (most recent call last) /snap/jupyter/6/lib/python3.7/ur
---------------------------------------------------------------------------
SSLCertVerificationError Traceback (most recent call last)
/snap/jupyter/6/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1316 h.request(req.get_method(), req.selector, req.data, headers,
-> 1317 encode_chunked=req.has_header('Transfer-encoding'))
1318 except OSError as err: # timeout error
/snap/jupyter/6/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)
1228 """Send a complete request to the server."""
-> 1229 self._send_request(method, url, body, headers, encode_chunked)
1230
/snap/jupyter/6/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1274 body = _encode(body, 'body')
-> 1275 self.endheaders(body, encode_chunked=encode_chunked)
1276
/snap/jupyter/6/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)
1223 raise CannotSendHeader()
-> 1224 self._send_output(message_body, encode_chunked=encode_chunked)
1225
/snap/jupyter/6/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)
1015 del self._buffer[:]
-> 1016 self.send(msg)
1017
/snap/jupyter/6/lib/python3.7/http/client.py in send(self, data)
955 if self.auto_open:
--> 956 self.connect()
957 else:
/snap/jupyter/6/lib/python3.7/http/client.py in connect(self)
1391 self.sock = self._context.wrap_socket(self.sock,
-> 1392 server_hostname=server_hostname)
1393
/snap/jupyter/6/lib/python3.7/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
411 context=self,
--> 412 session=session
413 )
/snap/jupyter/6/lib/python3.7/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
852 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 853 self.do_handshake()
854 except (OSError, ValueError):
/snap/jupyter/6/lib/python3.7/ssl.py in do_handshake(self, block)
1116 self.settimeout(None)
-> 1117 self._sslobj.do_handshake()
1118 finally:
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
<ipython-input-3-dc8b64eb545d> in <module>
----> 1 df = pd.read_html('http://www.fdic.gov/bank/individual/failed/banklist.html')
/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in read_html(io, match, flavor, header, index_col, skiprows, attrs, parse_dates, thousands, encoding, decimal, converters, na_values, keep_default_na, displayed_only)
1098 na_values=na_values,
1099 keep_default_na=keep_default_na,
-> 1100 displayed_only=displayed_only,
1101 )
/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in _parse(flavor, io, match, attrs, encoding, displayed_only, **kwargs)
893
894 try:
--> 895 tables = p.parse_tables()
896 except ValueError as caught:
897 # if `io` is an io-like object, check if it's seekable
/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in parse_tables(self)
211 list of parsed (header, body, footer) tuples from tables.
212 """
--> 213 tables = self._parse_tables(self._build_doc(), self.match, self.attrs)
214 return (self._parse_thead_tbody_tfoot(table) for table in tables)
215 """
/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in _build_doc(self)
731 pass
732 else:
--> 733 raise e
734 else:
735 if not hasattr(r, "text_content"):
/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/html.py in _build_doc(self)
712 try:
713 if is_url(self.io):
--> 714 with urlopen(self.io) as f:
715 r = parse(f, parser=parser)
716 else:
/home/paul/snap/jupyter/common/lib/python3.7/site-packages/pandas/io/common.py in urlopen(*args, **kwargs)
139 import urllib.request
140
--> 141 return urllib.request.urlopen(*args, **kwargs)
142
143
/snap/jupyter/6/lib/python3.7/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
220 else:
221 opener = _opener
--> 222 return opener.open(url, data, timeout)
223
224 def install_opener(opener):
/snap/jupyter/6/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)
529 for processor in self.process_response.get(protocol, []):
530 meth = getattr(processor, meth_name)
--> 531 response = meth(req, response)
532
533 return response
/snap/jupyter/6/lib/python3.7/urllib/request.py in http_response(self, request, response)
639 if not (200 <= code < 300):
640 response = self.parent.error(
--> 641 'http', request, response, code, msg, hdrs)
642
643 return response
/snap/jupyter/6/lib/python3.7/urllib/request.py in error(self, proto, *args)
561 http_err = 0
562 args = (dict, proto, meth_name) + args
--> 563 result = self._call_chain(*args)
564 if result:
565 return result
/snap/jupyter/6/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
501 for handler in handlers:
502 func = getattr(handler, meth_name)
--> 503 result = func(*args)
504 if result is not None:
505 return result
/snap/jupyter/6/lib/python3.7/urllib/request.py in http_error_302(self, req, fp, code, msg, headers)
753 fp.close()
754
--> 755 return self.parent.open(new, timeout=req.timeout)
756
757 http_error_301 = http_error_303 = http_error_307 = http_error_302
/snap/jupyter/6/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)
523 req = meth(req)
524
--> 525 response = self._open(req, data)
526
527 # post-process response
/snap/jupyter/6/lib/python3.7/urllib/request.py in _open(self, req, data)
541 protocol = req.type
542 result = self._call_chain(self.handle_open, protocol, protocol +
--> 543 '_open', req)
544 if result:
545 return result
/snap/jupyter/6/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
501 for handler in handlers:
502 func = getattr(handler, meth_name)
--> 503 result = func(*args)
504 if result is not None:
505 return result
/snap/jupyter/6/lib/python3.7/urllib/request.py in https_open(self, req)
1358 def https_open(self, req):
1359 return self.do_open(http.client.HTTPSConnection, req,
-> 1360 context=self._context, check_hostname=self._check_hostname)
1361
1362 https_request = AbstractHTTPHandler.do_request_
/snap/jupyter/6/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1317 encode_chunked=req.has_header('Transfer-encoding'))
1318 except OSError as err: # timeout error
-> 1319 raise URLError(err)
1320 r = h.getresponse()
1321 except:
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>
我已经看到了一些关于安装certifi的东西,但是它说这个要求已经满足了。我现在正在运行Ubuntu。
我注意到这是MacOS上的一个显著错误,所以我不确定这是什么
谢谢你抽出时间 SSL用于https协议,您尝试访问的链接使用不安全的http,大多数应用程序都会试图让您远离http站点。请尝试将“http://”更改为“https://”。https协议中使用SSL,您尝试访问的链接使用不安全的http,大多数应用程序都会试图让您远离http站点。尝试将“http://”更改为“https://”向链接添加“s”无法解决问题,出现了相同的错误。向链接添加“s”无法解决问题,出现了相同的错误。这是否回答了您的问题@AMC是个好主意,但这是个错误的重复问题。这个问题是关于一台Mac电脑,这个用户正在使用Linux。正如问题中提到的:我注意到这是Mac上的一个显著错误,所以我不确定它在这里是什么。@karel是的,你是对的,不敢相信我错过了那部分。facepalmFollow来配置您的SSLkey@HenriqueBranco我担心这似乎正超出了我的理解范围。我正在阅读您发送的内容,它说这是在“[my]网关节点已安装并已在服务器节点注册”之后出现的。这是我必须做的事情吗?我还下载了pycharm,并使用python的anaconda安装来运行它,如果这改变了什么,它就会工作。如果有,我会相应地更新帖子。这能回答你的问题吗@AMC是个好主意,但这是个错误的重复问题。这个问题是关于一台Mac电脑,这个用户正在使用Linux。正如问题中提到的:我注意到这是Mac上的一个显著错误,所以我不确定它在这里是什么。@karel是的,你是对的,不敢相信我错过了那部分。facepalmFollow来配置您的SSLkey@HenriqueBranco我担心这似乎正超出了我的理解范围。我正在阅读您发送的内容,它说这是在“[my]网关节点已安装并已在服务器节点注册”之后出现的。这是我必须做的事情吗?我还下载了pycharm,并使用python的anaconda安装来运行它,如果这改变了什么,它就会工作。如果有,我会相应地更新帖子。
df = pd.read_html('http://www.fdic.gov/bank/individual/failed/banklist.html')