You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File C:\ProgramData\anaconda3\Lib\http\client.py:1091, in HTTPConnection._send_output(self, message_body, encode_chunked)
1090 del self._buffer[:]
-> 1091 self.send(msg)
1093 if message_body is not None:
1094
1095 # create a consistent interface to message_body
File C:\ProgramData\anaconda3\Lib\http\client.py:1035, in HTTPConnection.send(self, data)
1034 if self.auto_open:
-> 1035 self.connect()
1036 else:
File C:\ProgramData\anaconda3\Lib\http\client.py:1470, in HTTPSConnection.connect(self)
1468 "Connect to a host on a given (SSL) port."
-> 1470 super().connect()
1472 if self._tunnel_host:
File C:\ProgramData\anaconda3\Lib\http\client.py:1001, in HTTPConnection.connect(self)
1000 sys.audit("http.client.connect", self, self.host, self.port)
-> 1001 self.sock = self._create_connection(
1002 (self.host,self.port), self.timeout, self.source_address)
1003 # Might fail in OSs that don't implement TCP_NODELAY
File C:\ProgramData\anaconda3\Lib\socket.py:841, in create_connection(address, timeout, source_address, all_errors)
840 exceptions = []
--> 841 for res in getaddrinfo(host, port, 0, SOCK_STREAM):
842 af, socktype, proto, canonname, sa = res
File C:\ProgramData\anaconda3\Lib\socket.py:976, in getaddrinfo(host, port, family, type, proto, flags)
975 addrlist = []
--> 976 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
977 af, socktype, proto, canonname, sa = res
gaierror: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
Cell In[12], line 2
1 import seaborn as sns
----> 2 iris_df = sns.load_dataset("iris")
File C:\ProgramData\anaconda3\Lib\site-packages\seaborn\utils.py:572, in load_dataset(name, cache, data_home, **kws)
570 cache_path = os.path.join(get_data_home(data_home), os.path.basename(url))
571 if not os.path.exists(cache_path):
--> 572 if name not in get_dataset_names():
573 raise ValueError(f"'{name}' is not one of the example datasets.")
574 urlretrieve(url, cache_path)
File C:\ProgramData\anaconda3\Lib\site-packages\seaborn\utils.py:499, in get_dataset_names()
493 def get_dataset_names():
494 """Report available example datasets, useful for reporting issues.
495
496 Requires an internet connection.
497
498 """
--> 499 with urlopen(DATASET_NAMES_URL) as resp:
500 txt = resp.read()
502 dataset_names = [name.strip() for name in txt.decode().split("\n")]
File C:\ProgramData\anaconda3\Lib\urllib\request.py:532, in OpenerDirector._open(self, req, data)
529 return result
531 protocol = req.type
--> 532 result = self._call_chain(self.handle_open, protocol, protocol +
533 '_open', req)
534 if result:
535 return result
File C:\ProgramData\anaconda3\Lib\urllib\request.py:492, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
490 for handler in handlers:
491 func = getattr(handler, meth_name)
--> 492 result = func(*args)
493 if result is not None:
494 return result
Activity
kbeckham1987 commentedon Apr 1, 2025
我想请教下,我输入import seaborn as sns后运行,没有输出结果也没报错,应该是运行成功了
但是再输入iris_df = sns.load_dataset("iris")后运行,直接就报了下面的错误:
gaierror Traceback (most recent call last)
File C:\ProgramData\anaconda3\Lib\urllib\request.py:1344, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args)
1343 try:
-> 1344 h.request(req.get_method(), req.selector, req.data, headers,
1345 encode_chunked=req.has_header('Transfer-encoding'))
1346 except OSError as err: # timeout error
File C:\ProgramData\anaconda3\Lib\http\client.py:1336, in HTTPConnection.request(self, method, url, body, headers, encode_chunked)
1335 """Send a complete request to the server."""
-> 1336 self._send_request(method, url, body, headers, encode_chunked)
File C:\ProgramData\anaconda3\Lib\http\client.py:1382, in HTTPConnection._send_request(self, method, url, body, headers, encode_chunked)
1381 body = _encode(body, 'body')
-> 1382 self.endheaders(body, encode_chunked=encode_chunked)
File C:\ProgramData\anaconda3\Lib\http\client.py:1331, in HTTPConnection.endheaders(self, message_body, encode_chunked)
1330 raise CannotSendHeader()
-> 1331 self._send_output(message_body, encode_chunked=encode_chunked)
File C:\ProgramData\anaconda3\Lib\http\client.py:1091, in HTTPConnection._send_output(self, message_body, encode_chunked)
1090 del self._buffer[:]
-> 1091 self.send(msg)
1093 if message_body is not None:
1094
1095 # create a consistent interface to message_body
File C:\ProgramData\anaconda3\Lib\http\client.py:1035, in HTTPConnection.send(self, data)
1034 if self.auto_open:
-> 1035 self.connect()
1036 else:
File C:\ProgramData\anaconda3\Lib\http\client.py:1470, in HTTPSConnection.connect(self)
1468 "Connect to a host on a given (SSL) port."
-> 1470 super().connect()
1472 if self._tunnel_host:
File C:\ProgramData\anaconda3\Lib\http\client.py:1001, in HTTPConnection.connect(self)
1000 sys.audit("http.client.connect", self, self.host, self.port)
-> 1001 self.sock = self._create_connection(
1002 (self.host,self.port), self.timeout, self.source_address)
1003 # Might fail in OSs that don't implement TCP_NODELAY
File C:\ProgramData\anaconda3\Lib\socket.py:841, in create_connection(address, timeout, source_address, all_errors)
840 exceptions = []
--> 841 for res in getaddrinfo(host, port, 0, SOCK_STREAM):
842 af, socktype, proto, canonname, sa = res
File C:\ProgramData\anaconda3\Lib\socket.py:976, in getaddrinfo(host, port, family, type, proto, flags)
975 addrlist = []
--> 976 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
977 af, socktype, proto, canonname, sa = res
gaierror: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
Cell In[12], line 2
1 import seaborn as sns
----> 2 iris_df = sns.load_dataset("iris")
File C:\ProgramData\anaconda3\Lib\site-packages\seaborn\utils.py:572, in load_dataset(name, cache, data_home, **kws)
570 cache_path = os.path.join(get_data_home(data_home), os.path.basename(url))
571 if not os.path.exists(cache_path):
--> 572 if name not in get_dataset_names():
573 raise ValueError(f"'{name}' is not one of the example datasets.")
574 urlretrieve(url, cache_path)
File C:\ProgramData\anaconda3\Lib\site-packages\seaborn\utils.py:499, in get_dataset_names()
493 def get_dataset_names():
494 """Report available example datasets, useful for reporting issues.
495
496 Requires an internet connection.
497
498 """
--> 499 with urlopen(DATASET_NAMES_URL) as resp:
500 txt = resp.read()
502 dataset_names = [name.strip() for name in txt.decode().split("\n")]
File C:\ProgramData\anaconda3\Lib\urllib\request.py:215, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
213 else:
214 opener = _opener
--> 215 return opener.open(url, data, timeout)
File C:\ProgramData\anaconda3\Lib\urllib\request.py:515, in OpenerDirector.open(self, fullurl, data, timeout)
512 req = meth(req)
514 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 515 response = self._open(req, data)
517 # post-process response
518 meth_name = protocol+"_response"
File C:\ProgramData\anaconda3\Lib\urllib\request.py:532, in OpenerDirector._open(self, req, data)
529 return result
531 protocol = req.type
--> 532 result = self._call_chain(self.handle_open, protocol, protocol +
533 '_open', req)
534 if result:
535 return result
File C:\ProgramData\anaconda3\Lib\urllib\request.py:492, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
490 for handler in handlers:
491 func = getattr(handler, meth_name)
--> 492 result = func(*args)
493 if result is not None:
494 return result
File C:\ProgramData\anaconda3\Lib\urllib\request.py:1392, in HTTPSHandler.https_open(self, req)
1391 def https_open(self, req):
-> 1392 return self.do_open(http.client.HTTPSConnection, req,
1393 context=self._context)
File C:\ProgramData\anaconda3\Lib\urllib\request.py:1347, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args)
1344 h.request(req.get_method(), req.selector, req.data, headers,
1345 encode_chunked=req.has_header('Transfer-encoding'))
1346 except OSError as err: # timeout error
-> 1347 raise URLError(err)
1348 r = h.getresponse()
1349 except:
URLError: <urlopen error [Errno 11001] getaddrinfo failed>
网上搜了很久也没解决问题,请问怎么处理?