未配置名为“_tkinter"的模块 [英] No module named '_tkinter' configured
问题描述
ModuleNotFoundError: 没有名为_tkinter"的模块
ModuleNotFoundError: No module named '_tkinter'
我想在 Python 3.7 中导入乌龟
I want to import turtle in Python 3.7
回溯(最近一次调用最后一次):文件my.py",第 1 行,在from turtle import * File "/usr/local/lib/python3.7/turtle.py", line 107, in将 tkinter 导入为 TK 文件/usr/local/lib/python3.7/tkinter/init.py",第 36 行,在import _tkinter # 如果失败,你的 Python 可能没有被配置为 Tk ModuleNotFoundError: No module named '_tkinter'
Traceback (most recent call last): File "my.py", line 1, in from turtle import * File "/usr/local/lib/python3.7/turtle.py", line 107, in import tkinter as TK File "/usr/local/lib/python3.7/tkinter/init.py", line 36, in import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter'
推荐答案
从源代码构建python时,如果Tk
开发文件丢失,构建以
When building python from source, if the Tk
development files are missing,
the build ends with
The necessary bits to build these optional modules were not found:
_tkinter
开发文件可以从分发包安装.例如,在 openSUSE Leap-15 中:
The development files can be installed from the distribution packager. for instance, in openSUSE Leap-15:
sudo zypper install tk-devel
这篇关于未配置名为“_tkinter"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!