importError No module named multiarry

在terminal输入python后,执行命令报错:

import numpy
import pickle
import numpy.core.multiarray
data = pickle.load(open('Workspace/Ch5_Py_Mrjob_PegasosSVM/svmDat27','rb'))

报错:
Traceback (most recent call last):
File “”, line 1, in
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1384, in load
return Unpickler(file).load()
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 864, in load
dispatchkey
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1096, in load_global
klass = self.find_class(module, name)
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1130, in find_class
import(module)
ImportError: No module named multiarray

data = pickle.load(open('Workspace/Ch5_Py_Mrjob_PegasosSVM/svmDat27','r'))

报错:
Traceback (most recent call last):
File “”, line 1, in
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1384, in load
return Unpickler(file).load()
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 864, in load
dispatchkey
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1096, in load_global
klass = self.find_class(module, name)
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1130, in find_class
import(module)
ImportError: No module named multiarray

 data = pickle.load(open('Workspace/Ch5_Py_Mrjob_PegasosSVM/svmDat27'))

继续报错:
Traceback (most recent call last):
File “”, line 1, in
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1384, in load
return Unpickler(file).load()
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 864, in load
dispatchkey
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1096, in load_global
klass = self.find_class(module, name)
File “/home/hduser/anaconda2/lib/python2.7/pickle.py”, line 1130, in find_class
import(module)
ImportError: No module named multiarray

补充解决方案来了

并不是代码本身的编码有问题,是数据存储格式有问题1!!!1解决方法:vim 进入数据文件,:set ff=unix

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值