(Python)ColabTurtle需要有initializeturtle()错误,但我们已经使用过它了

5cg8jx4n  于 2023-02-21  发布在  Python
关注(0)|答案(1)|浏览(101)

代码:

import ColabTurtle.Turtle as tutel
tutel.initializeTurtle()
tutel.forward(10)

错误为:

<IPython.core.display.HTML object>
Traceback (most recent call last):
  File "f:\stuff\e.py", line 3, in <module>
    tutel.forward(10)
  File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 174, in forward
    _moveToNewPosition(ending_point)
  File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 163, in _moveToNewPosition
    _updateDrawing()
  File "C:\Users\U.S.E.R\AppData\Local\Programs\Python\Python311\Lib\site-packages\ColabTurtle\Turtle.py", line 144, in _updateDrawing    
    raise AttributeError("Display has not been initialized yet. Call initializeTurtle() before using.")
AttributeError: Display has not been initialized yet. Call initializeTurtle() before using.

基本上,它告诉我在运行ColabTurtle函数之前使用intializeturtle(),只是我已经用过了。
帮帮我。

ovfsdjhp

ovfsdjhp1#

试着在Google Collab中运行它,如果不会有模块ColabTurtle,你需要创建一个新的代码(+code)并写

!pip install ColabTurtle

相关问题