解决Python小问题:CRC check failed

今天拿一个逻辑回归的小程序运行,出现以下报错:

Traceback (most recent call last):

  File "E:\deep-learning\deep\logistic.py", line 475, in
    sgd_optimization_mnist()
  File "E:\deep-learning\deep\logistic.py", line 277, in sgd_optimization_mnist
    datasets = load_data(dataset)
  File "E:\deep-learning\deep\logistic.py", line 214, in load_data
    train_set, valid_set, test_set = pickle.load(f)
  File "D:\python27\lib\gzip.py", line 268, in read
    self._read(readsize)
  File "D:\python27\lib\gzip.py", line 315, in _read
    self._read_eof()
  File "D:\python27\lib\gzip.py", line 354, in _read_eof
    hex(self.crc)))

IOError: CRC check failed 0x6764735e != 0x2add2c50L


问题原因是mnist.pkl.gz数据包与程序不在没有放在Python根目录下,导致程序找不到对应文件夹和数据


解决办法:1,当然是将两者放在根目录下运行;2,利用 sys.path.append 添加目录到Python根目录(但这只能是一次运行有效)。


你可能感兴趣的:(解决Python小问题:CRC check failed)