python中加载数据失败_Python:加载MNIST数据时出错

在尝试使用sklearn.datasets.fetch_mldata加载MNIST数据集时,遇到了TimeoutError。错误出现在urllib.request模块中,连接超时,无法从指定URL获取数据。
摘要由CSDN通过智能技术生成

TimeoutErrorTraceback(most recent call last)in()1fromsklearn.datasetsimportfetch_mldata---->2mnist=fetch_mldata('MNIST original')~\Anaconda3\lib\site-packages\sklearn\datasets\mldata.pyinfetch_mldata(dataname,target_name,data_name,transpose_data,data_home)152urlname=MLDATA_BASE_URL%quote(dataname)153try:-->154mldata_url=urlopen(urlname)155exceptHTTPErrorase:156ife.code==404:~\Anaconda3\lib\urllib\request.pyinurlopen(url,data,timeout,cafile,capath,cadefault,context)221else:222opener=_opener-->223returnopener.open(url,data,timeout)224225definstall_opener(opener):~\Anaconda3\lib\urllib\request.pyinopen(self,fullurl,data,timeout)524req=meth(req)525-->526response=self._open(req,data)527528# post-process response~\Anaconda3\lib\urllib\request.pyin_open(self,req,data)542protocol=req.type543result=self._call_chain(self.handle_open,protocol,protocol+-->544'_open',req)545ifresult:546returnresult~\Anaconda3\lib\urllib\request.pyin_call_chain(self,chain,kind,meth_name,*args)502forhandlerinhandlers:503func=getattr(handler,meth_name)-->504result=func(*args)505ifresultisnotNone:506returnresult~\Anaconda3\lib\urllib\request.pyinhttp_open(self,req)13441345defhttp_open(self,req):->1346returnself.do_open(http.client.HTTPConnection,req)13471348http_request=AbstractHTTPHandler.do_request_~\Anaconda3\lib\urllib\request.pyindo_open(self,http_class,req,**http_conn_args)1319exceptOSErroraserr:# timeout error1320raiseURLError(err)->1321r=h.getresponse()1322except:1323h.close()~\Anaconda3\lib\http\client.pyingetresponse(self)1329try:1330try:->1331response.begin()1332exceptConnectionError:1333self.close()~\Anaconda3\lib\http\client.pyinbegin(self)295# read until we get a non-100 response296whileTrue:-->297version,status,reason=self._read_status()298ifstatus!=CONTINUE:299break~\Anaconda3\lib\http\client.pyin_read_status(self)256257def_read_status(self):-->258line=str(self.fp.readline(_MAXLINE+1),"iso-8859-1")259iflen(line)>_MAXLINE:260raiseLineTooLong("status line")~\Anaconda3\lib\socket.pyinreadinto(self,b)584whileTrue:585try:-->586returnself._sock.recv_into(b)587excepttimeout:588self._timeout_occurred=TrueTimeoutError:[WinError10060]A connection attempt failed because the connected party didnotproperly respond after a period of time,orestablished connection failed because connected host has failed to respond

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值