OSError: [Errno socket error] [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应
错误信息如下:
TimeoutError Traceback (most recent call last)
D:\Anaconda\lib\urllib\request.py in open(self, fullurl, data)
1756 if data is None:
-> 1757 return getattr(self, name)(url)
1758 else:
D:\Anaconda\lib\urllib\request.py in open_http(self, url, data)
1935 """Use HTTP protocol."""
-> 1936 return self._open_generic_http(http.client.HTTPConnection, url, data)
1937
D:\Anaconda\lib\urllib\request.py in _open_generic_http(self, connection_factory, url, data)
1915 else:
-> 1916 http_conn.request("GET", selector, headers=headers)
1917
D:\Anaconda\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1238 """Send a complete request to the server."""
-> 1239 self._send_request(method, url, body, headers, encode_chunked)
1240
D:\Anaconda\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1284 body = _encode(body, 'body')
-> 1285 self.endheaders(body, encode_chunked=encode_chunked)
1286
D:\Anaconda\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1233 raise CannotSendHeader()
-> 1234 self._send_output(message_body, encode_chunked=encode_chunked)
1235
D:\Anaconda\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1025 del self._buffer[:]
-> 1026 self.send(msg)
1027
D:\Anaconda\lib\http\client.py in send(self, data)
963 if self.auto_open:
--> 964 self.connect()
965 else:
D:\Anaconda\lib\http\client.py in connect(self)
935 self.sock = self._create_connection(
--> 936 (self.host,self.port), self.timeout, self.source_address)
937 self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
D:\Anaconda\lib\socket.py in create_connection(address, timeout, source_address)
723 if err is not None:
--> 724 raise err
725 else:
D:\Anaconda\lib\socket.py in create_connection(address, timeout, source_address)
712 sock.bind(source_address)
--> 713 sock.connect(sa)
714 # Break explicitly a reference cycle
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
<ipython-input-11-d071c761582d> in <module>()
1 opener = urllib.request.URLopener()
----> 2 opener.retrieve(DOWNLOAD_BASE + MODEL_FILE, MODEL_FILE)
3 tar_file = tarfile.open(MODEL_FILE)
4 for file in tar_file.getmembers():
5 file_name = os.path.basename(file.name)
D:\Anaconda\lib\urllib\request.py in retrieve(self, url, filename, reporthook, data)
1789 except OSError as msg:
1790 pass
-> 1791 fp = self.open(url, data)
1792 try:
1793 headers = fp.info()
D:\Anaconda\lib\urllib\request.py in open(self, fullurl, data)
1761 raise
1762 except OSError as msg:
-> 1763 raise OSError('socket error', msg).with_traceback(sys.exc_info()[2])
1764
1765 def open_unknown(self, fullurl, data=None):
D:\Anaconda\lib\urllib\request.py in open(self, fullurl, data)
1755 try:
1756 if data is None:
-> 1757 return getattr(self, name)(url)
1758 else:
1759 return getattr(self, name)(url, data)
D:\Anaconda\lib\urllib\request.py in open_http(self, url, data)
1934 def open_http(self, url, data=None):
1935 """Use HTTP protocol."""
-> 1936 return self._open_generic_http(http.client.HTTPConnection, url, data)
1937
1938 def http_error(self, url, fp, errcode, errmsg, headers, data=None):
D:\Anaconda\lib\urllib\request.py in _open_generic_http(self, connection_factory, url, data)
1914 http_conn.request("POST", selector, data, headers)
1915 else:
-> 1916 http_conn.request("GET", selector, headers=headers)
1917
1918 try:
D:\Anaconda\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1237 encode_chunked=False):
1238 """Send a complete request to the server."""
-> 1239 self._send_request(method, url, body, headers, encode_chunked)
1240
1241 def _send_request(self, method, url, body, headers, encode_chunked):
D:\Anaconda\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1283 # default charset of iso-8859-1.
1284 body = _encode(body, 'body')
-> 1285 self.endheaders(body, encode_chunked=encode_chunked)
1286
1287 def getresponse(self):
D:\Anaconda\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1232 else:
1233 raise CannotSendHeader()
-> 1234 self._send_output(message_body, encode_chunked=encode_chunked)
1235
1236 def request(self, method, url, body=None, headers={}, *,
D:\Anaconda\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1024 msg = b"\r\n".join(self._buffer)
1025 del self._buffer[:]
-> 1026 self.send(msg)
1027
1028 if message_body is not None:
D:\Anaconda\lib\http\client.py in send(self, data)
962 if self.sock is None:
963 if self.auto_open:
--> 964 self.connect()
965 else:
966 raise NotConnected()
D:\Anaconda\lib\http\client.py in connect(self)
934 """Connect to the host and port specified in __init__."""
935 self.sock = self._create_connection(
--> 936 (self.host,self.port), self.timeout, self.source_address)
937 self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
938
D:\Anaconda\lib\socket.py in create_connection(address, timeout, source_address)
722
723 if err is not None:
--> 724 raise err
725 else:
726 raise error("getaddrinfo returns an empty list")
D:\Anaconda\lib\socket.py in create_connection(address, timeout, source_address)
711 if source_address:
712 sock.bind(source_address)
--> 713 sock.connect(sa)
714 # Break explicitly a reference cycle
715 err = None
OSError: [Errno socket error] [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
Load a (frozen) Tensorflow model into memory.
这个是我在运行tensorflow object_detection的model的时候遇到的问题,不知道该如何解决,希望能够得到指导,谢谢!!!
同时import matplotlib; matplotlib.use('Agg') # pylint: disable=multiple-statemen我按照网上的修改方法:将from matplotlib import pyplot as plt 改为import matplotlib.pyplot as plt 后有时也会出现报错