python - 没有名为“tkinter”的模块 - 出现错误
问题描述
我一直在尝试在我的 Visual Studio 2019 社区版中运行某个海龟代码。
但我一次又一次地收到这个错误。PS Normal python 在 VS ide 上运行良好。
错误
Message=No module named 'tkinter'
Source=D:\visual studio\python trials\day6trial\example\example\example.py
StackTrace:
File "D:\visual studio\python trials\day6trial\example\example\example.py", line 1, in <module>
from turtle import *
我一直在尝试运行的代码是:
from turtle import *
speed(0)
bgcolor('black')
x = 1
while x < 400:
colormode(255) # this is something that is irrelevant at this point
# check the pythondocs link at the end for more info
pencolor(255,255,255) # changes the color of the pen to the rgb coordinates
# obtained by the variables r, g, b changing each time
fd(50 + x)
rt(90.911)
x = x+1
exitonclick()
自从我在笔记本电脑中安装了 nodejs 和 vscode 以来,这个问题一直在发生。
请帮忙。
解决方案
推荐阅读
- mysql - SQL如何在变化的时间范围内计算不同的ID
- python - Python spyder IDE初学者-for循环定义中的错误
- python - Python在同一行打印多行值
- python - Python从文件夹中的所有excel文件中提取第一张表
- .net - 没有存储库的 ef 核心控制器
- django - Django内联模型表单集和内联模型表单处理初始不同
- python - 使用朴素贝叶斯模型获得良好结果所需的最少特征数是多少?
- windows - 如何在 Skiko(Kotlin MPP 绑定到 Skia)上制作基本动画?
- netlogo - NetLogo:移动海龟,直到它们找到最佳位置
- javascript - 如何在没有访问控制标头的情况下使用 php 从 Javascript 中读取 Json 文件中的内容