我收到以下错误:
Traceback (most recent call last):
File "C:/Users/yashg/AppData/Local/Programs/Python/Python36-32/turtle2.py", line 1, in <module>
import turtle
File "C:/Users/yashg/AppData/Local/Programs/Python/Python36-32\turtle.py", line 18, in <module>
draw_square()
File "C:/Users/yashg/AppData/Local/Programs/Python/Python36-32\turtle.py", line 3, in draw_square
window=turtle.Screen()
AttributeError: module 'turtle' has no attribute 'Screen'
答案 0 :(得分:1)
您应该重命名turtle.py
以外的脚本。否则会阻止导入标准库turtle
;首先搜索模块并导入模块而不是标准库。
还要确保目录turtle.pyc
中没有C:\Users\yashg\AppData\Local\Programs\Python\Python36-32
。