AttributeError: module '***' has no attribute '***'

AttributeError: module ‘***’ has no attribute '***'问题的解决方法

google 后说是生成的.pyc 文件的问题,删除后在运行就可以,但删除.pyc 文件运行还是报错: AttributeError: ‘module’ object has no attribute ‘make’。

又有人说是import 的那个库.pyc 文件也要删除, 好,这次把import库的.pyc 也删除,但依据报错!

无奈改了修改了脚本的文件名,莫名其妙可以执行了,忽然想起,和import标准库命名冲突了

脚本命名为qrcode.py 要引用的库 也是qrcode

解决办法:

重命名脚本文件,不能和要引入的模块名称冲突! 不然导入不是模块而是自己创建的文件!

在这网址查到解决方案

猜你喜欢

转载自blog.csdn.net/qq_33839192/article/details/88822152