简体   繁体   中英

Is numpy.save cross platform?

Suppose I save a numpy array to a file, "arr.npy", using numpy.save() and that I do this using a particular python version, numpy version, and OS.

Can I load, using numpy.load(), arr.npy on a different OS using a different version of python or numpy? Are there any restrictions, such as backwards compatibility?

Yes. The .npy format is documented here:

https://github.com/numpy/numpy/blob/master/doc/neps/npy-format.rst

Note this comment in the source code (emphasis mine):

The .npy format is the standard binary file format in NumPy for persisting a single arbitrary NumPy array on disk. The format stores all of the shape and dtype information necessary to reconstruct the array correctly even on another machine with a different architecture .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM