import numpy as np
array = np.zeros((210000, 210000)) # default numpy.float64
array.nbytes
Run Code Online (Sandbox Code Playgroud)
当我在带有macOS的8GB内存MacBook上运行上述代码时,不会发生错误.但是在配备Windows 10的16GB内存PC或12GB内存Ubuntu笔记本电脑上运行相同的代码,甚至在128GB内存的Linux超级计算机上运行相同的代码,Python解释器将引发MemoryError.所有测试环境都安装了64位Python 3.6或3.7.