相关疑难解决方法(0)

Tkinter:"可能没有为Tk配置Python"

今天我想开始与Tkinter合作,但我遇到了一些问题.

Python 3.2 (r32:88445, Mar 28 2011, 04:14:07) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from tkinter import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/tkinter/__init__.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
Run Code Online (Sandbox Code Playgroud)

那么如何配置我的Python 3.2以使用Tkinter?

python tkinter python-3.x

65
推荐指数
9
解决办法
11万
查看次数

无法在 MacOS 上使用 pyenv Python 安装 tkinter

通过 pyenv 安装的 Python 版本无法导入tkinter

? python
Python 3.8.1 (default, Feb 29 2020, 11:45:59)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/factor/.pyenv/versions/3.8.1/lib/python3.8/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
>>>
Run Code Online (Sandbox Code Playgroud)

或者您可能会收到有关标头版本与二进制文件不匹配的消息:

DEPRECATION WARNING: The system version of Tk is deprecated …
Run Code Online (Sandbox Code Playgroud)

python macos tkinter pyenv

42
推荐指数
3
解决办法
1万
查看次数

在ubuntu 14.04上安装tkinter

我想在Ubuntu 14.04上运行python代码,但是当我执行它时,它会给我以下错误消息

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    from tkinter import *
ImportError: No module named tkinter
Run Code Online (Sandbox Code Playgroud)

python tkinter python-2.7 ubuntu-14.04

36
推荐指数
3
解决办法
13万
查看次数

为什么 tkinter(或海龟)似乎丢失或损坏?它不应该是标准库的一部分吗?

当尝试使用 Tkinter 标准库包或其相关功能(海龟图形使用turtle和内置 IDLE IDE)或使用将此作为依赖项的第三方库(例如显示使用 Matplotlib 的图形窗口)。

似乎即使不存在因隐藏标准库模块名称而引起的问题(对于尝试遵循教程并使用海龟图形的初学者来说,这是一个常见问题 -示例 1示例 2示例 3示例 4),通常会发生标准库 Tkinter 无法工作的情况。这是一个大问题,因为许多初学者再次尝试遵循使用海龟图形的教程,并盲目地假设turtle标准库将会存在。

可能会报错:

当 Tkinter 被记录为标准库的一部分时,为什么会出现这样的问题?如何添加或修复缺少的标准库功能?对于特定的 …

python installation tkinter modulenotfounderror

19
推荐指数
1
解决办法
9813
查看次数