[英]ModuleNotFoundError: No module named 'tkinter' after
I have been recently attempting to try out some minor game development with Python 3.9 and have been running into some problems.我最近一直在尝试使用 Python 3.9 进行一些小型游戏开发,但遇到了一些问题。 For some reason, Python does not recognize that I have tkinter installed.
出于某种原因,Python 无法识别我安装了 tkinter。 From what I have seen online, a big fix is to make sure the path variables are set up correctly.
从我在网上看到的情况来看,一个重要的解决方法是确保正确设置路径变量。 I have already added it to my env variables but that has not seemed to fix anything.
我已经将它添加到我的环境变量中,但这似乎并没有解决任何问题。
I also know I have it installed, as I see it here in my Python site-packages folder.我也知道我已经安装了它,正如我在 Python 站点包文件夹中看到的那样。
At this point, I am stumped.在这一点上,我被难住了。 I do have the import as tkinter as well and not Tkinter.
我也有导入为 tkinter 而不是 Tkinter。 The only thing I can think of now is totally uninstalling Python but I would prefer not to do that if there are any other options.
我现在唯一能想到的就是完全卸载 Python 但如果有其他选择,我宁愿不这样做。
Here is the code:这是代码:
import math
import random
import pygame
import tkinter as tk
from tkinter import messagebox
class cube(object):
rows = 20
w = 500
I am using Windows 10 and VSCode as well.我也在使用 Windows 10 和 VSCode。 Anything helps and thanks!
有什么帮助,谢谢!
Seems I somehow screwed up my Python installation.似乎我以某种方式搞砸了我的 Python 安装。 Completely removing it from my system and reinstalling seemed to fix all of my issues.
从我的系统中完全删除它并重新安装似乎解决了我的所有问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.