python程序运行时报错:

class GzipFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'

 

我们看到BufferedIOBase是io库的类,按说应该是有这个类的。我们查找io库的代码,也确实发现了BufferedIOBase。

AttributeError: 'module' object has no attribute 'BufferedIOBase' installing

那么报这个错是因为什么?

原因是:

我的项目里还定义了一个io的包,它混淆了stdlib的io库。

将它重命名即可解决。参考

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-15
  • 2021-06-06
  • 2021-07-27
  • 2022-02-07
  • 2021-06-27
  • 2022-12-23
相关资源
相似解决方案