![](/img/trans.png)
[英]Python error: unpack requires a string argument of length 4, but it is?
[英]mxnet tutorials unpack requires a string argument of length 8
最近,我通過遵循mxnet.io
的教程學習了mxnet.io
。 在“手寫數字識別”中,我運行以下代碼:
import mxnet as mx
mnist = mx.test_utils.get_mnist()
表明:
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-1-9ce98614649e> in <module>()
1 import mxnet as mx
----> 2 mnist=mx.test_utils.get_mnist()
/home/lthpc/mxnet/python/mxnet/test_utils.pyc in get_mnist()
1014 path = 'http://data.mxnet.io/data/mnist/'
1015 (train_lbl, train_img) = read_data(
-> 1016 path+'train-labels-idx1-ubyte.gz', path+'train-images-idx3-ubyte.gz')
1017 (test_lbl, test_img) = read_data(
1018 path+'t10k-labels-idx1-ubyte.gz', path+'t10k-images-idx3-ubyte.gz')
/home/lthpc/mxnet/python/mxnet/test_utils.pyc in read_data(label_url, image_url)
1002 def read_data(label_url, image_url):
1003 with gzip.open(mx.test_utils.download(label_url)) as flbl:
-> 1004 struct.unpack(">II", flbl.read(8))
1005 label = np.fromstring(flbl.read(), dtype=np.int8)
1006 with gzip.open(mx.test_utils.download(image_url), 'rb') as fimg:
error: unpack requires a string argument of length 8
我怎樣才能解決這個問題?
似乎您使用的是MXNet的舊版本。 您是否可以使用MXNet的最新版本來重現此內容。 請提供該問題的復制步驟,包括運行該問題的環境。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.