首页 > 解决方案 > 没有名为“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 以来,这个问题一直在发生。

请帮忙。

标签: pythonvisual-studiotkinter

解决方案


推荐阅读