Python OSError:从大文件读取时地址错误

Sur*_*me0 5 python io centos

OSError从使用withPython 3 中的语法创建的文件句柄读取时,我观察到“错误地址” 。

有问题的文件是 39G,但我应该有足够的 RAM 来读取整个文件。错误消息让我相信我遇到了某种操作系统限制;我正在运行 CentOS 6.9。任何人都可以帮助我了解可能导致这种行为的原因吗?

该文件在 python 之外是完全可读的,例如在带有head或 的bash 中vim

产生错误的简化代码示例如下所示:

In [2]: with open(filename, 'r', encoding="utf8") as infile:
   ...:     infile.read()
   ...:     
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-2-3f216811bec7> in <module>()
  1 with open(filename, 'r', encoding="utf8") as infile:
----> 2     infile.read()
  3 

OSError: [Errno 14] Bad address
Run Code Online (Sandbox Code Playgroud)