从在colab上学习python开始。屏幕上显示的google ageting错误

2024-04-20 07:02:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我得到这个错误,当我试图运行在“colab谷歌”。对python还不太熟悉,所以不太清楚可能是什么问题。显示变量丢失。 错误如下

TclError                                  Traceback (most recent call last)
<ipython-input-9-13bc468cf9c3> in <module>()
      1 import turtle
----> 2 toy = turtle.Pen()
      3 for i in range(1,40):
      4   toy.circle(100)
      5   toy.right(10)

4 frames
/usr/lib/python3.6/tkinter/__init__.py in __init__(self, screenName, baseName, className, useTk, sync, use)
   2021                 baseName = baseName + ext
   2022         interactive = 0
-> 2023         self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
   2024         if useTk:
   2025             self._loadtk()

TclError: no display name and no $DISPLAY environment variable

Tags: inselfinitusetkinter错误syncinteractive