python pickle import numpy variable error: "ImportError: No module named multiarray"

Yes, today I'm here again for everyone.

The problem is "ImportError: No module named multiarray".

This problem arises like this. When I am doing a competition, I need to extract a feature. The calculation of this feature is more complicated and takes a long time. So I ran it on my lab desktop (WIN7 64bit) and ended up with a vector stored as a numpy column vector.
So I directly use pickle to store this variable, then copy it to my computer (ubuntu), and import it again with pickle.load.

Sounds fine. But got this error "ImportError: No module named multiarray"

The variables themselves are stored in numpy.array format, the multiarray case is not involved.
But I still add various ways to import multiarray in my program at first

Something like: Tried these but didn't work. So I imported it normally on my desktop again, no problem.
from numpy import multiarray
import numpy.core.multiarry
from numpy import *

Finally, I checked it, and it should be that the different environment of the system caused the coding to be a little different.
So, when pickle.dump on the desktop, you need open('xxxxxxx.np','wb') instead of open('xxxxxxx.np','w')

Then the problem is solved.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325878475&siteId=291194637