The MemoryError exception that you are seeing is the direct result of running out of available RAM. This could be caused by either the 2GB per program limit imposed by Windows (32bit programs), or lack of available RAM on your computer. (This link is to a previous question). You should be able to extend the 2GB by using 64bit copy of Python, provided you are using a 64bit copy of windows.
引用托马斯this answer的话:
因此,请尝试64位的Python副本,或者提供有关您的平台和Python版本的更多详细信息。在
虽然我还没能测试它,但是Pyshp应该能够读取它,而不管文件大小或内存限制如何。创建
Reader
实例不会加载整个文件,只加载头信息。在这里的问题似乎是您使用了
shapes()
方法,它一次将所有形状信息读入内存。这通常不是个问题,但是对于这么大的文件来说。一般来说,您应该使用iterShapes()
方法,该方法逐个读取每个形状。在相关问题 更多 >
编程相关推荐