简体   繁体   English

numpy.save跨平台吗?

[英]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. 假设我使用numpy.save()将numpy数组保存到文件“arr.npy”,并且我使用特定的python版本,numpy版本和操作系统执行此操作。

Can I load, using numpy.load(), arr.npy on a different OS using a different version of python or numpy? 我可以使用不同版本的python或numpy在不同的操作系统上使用numpy.load(),arr.npy加载吗? Are there any restrictions, such as backwards compatibility? 是否存在任何限制,例如向后兼容性?

Yes. 是。 The .npy format is documented here: 这里记录了.npy格式:

https://github.com/numpy/numpy/blob/master/doc/neps/npy-format.rst 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. .npy格式是NumPy中的标准二进制文件格式,用于在磁盘上保留单个任意NumPy阵列。 The format stores all of the shape and dtype information necessary to reconstruct the array correctly even on another machine with a different architecture . 该格式存储了即使在具有不同体系结构的另一台机器上也能正确重建阵列所需的所有形状和dtype信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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