Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在TensorFlow Udacity课程中无法下载notMNIST_Python_Tensorflow - Fatal编程技术网

Python 在TensorFlow Udacity课程中无法下载notMNIST

Python 在TensorFlow Udacity课程中无法下载notMNIST,python,tensorflow,Python,Tensorflow,我正在学习Udacity TensorFlow课程,第一个练习: OSX 10.11(El Capitan) Python 2.7 TF的虚拟安装 我得到一个错误: “异常:验证Notmnist_large.tar.gz失败。您能用浏览器访问它吗?” 它可以找到“小”文件,但不能找到“大”文件。感谢您的帮助。谢谢 下面是整个代码块: >>> url = 'http://yaroslavvb.com/upload/notMNIST/' >>> >>

我正在学习Udacity TensorFlow课程,第一个练习:

OSX 10.11(El Capitan) Python 2.7 TF的虚拟安装

我得到一个错误:

“异常:验证Notmnist_large.tar.gz失败。您能用浏览器访问它吗?”

它可以找到“小”文件,但不能找到“大”文件。感谢您的帮助。谢谢

下面是整个代码块:

>>> url = 'http://yaroslavvb.com/upload/notMNIST/'
>>> 
>>> def maybe_download(filename, expected_bytes):
...   """Download a file if not present, and make sure it's the right size."""
...   if not os.path.exists(filename):
...     filename, _ = urlretrieve(url + filename, filename)
...   statinfo = os.stat(filename)
...   if statinfo.st_size == expected_bytes:
...     print('Found and verified', filename)
...   else:
...     raise Exception(
...       'Failed to verify' + filename + '. Can you get to it with a browser?')
...   return filename
... 
以下是返回的内容:

 >>> train_filename = maybe_download('notMNIST_large.tar.gz', 247336696)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 10, in maybe_download
Exception: Failed to verifynotMNIST_large.tar.gz. Can you get to it with a browser?
>>> test_filename = maybe_download('notMNIST_small.tar.gz', 8458043)
Found and verified notMNIST_small.tar.gz
>>train\u filename=maybe\u download('notMNIST\u large.tar.gz',24733696)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“”,第10行,下载
异常:验证Notmnist_large.tar.gz失败。你能用浏览器找到它吗?
>>>test_filename=maybe_download('notMNIST_small.tar.gz',8458043)
发现并验证notMNIST_small.tar.gz
我在Udacity论坛上找到了这个问题的解决方案(解决方法?)

在本页中,提出了两种解决方案

a。通过浏览器本地下载notMNIST_large.tar.gz,并使用docker命令进行复制

b。在抓取脚本中添加“用户代理”标题


我认为这两种方法都很好。

也面临同样的情况

这是一件简单的事情来处理它并继续下去

尺寸不匹配

只需使用force=True重新运行代码,然后 现在就可以了

如果您尝试手动下载,也可以

如本线程中所述:


希望有帮助。

您的代码专门测试下载的大小,并将其与预先确定的文件大小进行比较。如果大小不匹配,则会引发异常。检查下载文件的大小(手动)并重新验证您期望的大小。您能解决这个问题吗?是的,我能使它工作。@h7r如何使用docker命令复制它?我只是尝试复制粘贴,但它不起作用。