![](/img/trans.png)
[英]#Python Why do I keep getting namedtuple attribute error for this code?
[英]why do I keep getting Attribute error in python 3.9
import turtle
wn = turtle.Screen()
alex = turtle.Turtle()
alex.forward(150)
alex.left(90)
alex.forward(75)
turtle.done()
那是我的代码。 我不断收到的错误是:
File "C:/Users/stevewestmoreland/Documents\turtle.py", line 2, in <module>
wn = turtle.Screen()
AttributeError: partially initialized module 'turtle' has no attribute 'Screen' (most likely due to a circular import)
您将自己的脚本命名为turtle.py
,它会影响您认为要导入的turtle
模块; 只能有一个具有给定名称的模块,而您从“真正的” turtle
那里偷走了它。 使用不同的名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.