Python:加载.dat文件时无法解释为pickle?

时间:2016-06-29 16:35:01

标签: python-2.7 python-3.x numpy

我有一个numpy,在python 3+中保存为data.dat文件。当我在python 2.7中加载它

import numpy as np
data = np.load("data.data")

它会抛出错误

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-17-c9c3d37c74d4> in <module>()
      8 startTime = datetime.now()
      9 vocabulary =[]
---> 10 data =np.load("data.dat")

/usr/lib/python2.7/dist-packages/numpy/lib/npyio.pyc in load(file, mmap_mode)
    399             except:
    400                 raise IOError(
--> 401                     "Failed to interpret file %s as a pickle" % repr(file))
    402     finally:
    403         if own_fid:

IOError: Failed to interpret file 'data.dat' as a pickle

有什么办法可以解决吗?

0 个答案:

没有答案