出现module 'queue' has no attribute 'Queue'问题的解决
目录
- module 'queue'http://www.devze.com has no attribute '编程客栈;Queue'
- 解决方法
- python:AttributeError: module 'xxx' has no attribute 'xxx'的错误
- 1.手动安装该模块
- 2.检查文件名
- 总结
module 'queue开发者_C入门' has no attribute 'Queue'
import queue
qphp = queue.Queue()
q.put('a')
q.put('b')
print(q.get())
错误:
AttributeError: module 'queue' has no attribute 'Qu编程客栈eue'
解决方法
![]()
把程序名命名和包名一样导致错误。命名为queue1.py就ok了
python:AttributeError: module 'xxx' has no attribute 'xxx'的错误
运行python编程程序时,也许会出现这样的错误:
AttributeError: module ‘xxx’ has no attribute ‘xxx’
如:

在我的学习中,解决该错误有两种方法
1.手动安装该模块

2.检查文件名
这个方式看起来很傻,但是却是新手经常会犯的错,原因是因为自己的文件名称和要使用的模块重名了:

只需要更改文件名即可
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持我们。
加载中,请稍侯......
精彩评论