当前位置: 首页 > 知识库问答 >
问题:

GDB: ModuleNotFoundError:没有名为'_tkinter'的模块

湛光明
2023-03-14

因此,我试图调试我的C代码运行在Python ctype: gdb:打在Python加载的共享库。但是,每当我运行gdb我得到以下错误:ModuleNotFoundError:没有名为'_tkinter'的模块。我知道有很多关于这个错误的问题:matplotlib错误——没有名为tkinter的模块,没有名为“Tkinter”的模块。我尝试了以下方法:

sudo apt-get install python-tk

sudo apt-get install python3-tk

共有2个答案

许寒
2023-03-14

我面临同样的错误。升级您的Python版本。我希望这对你有用

穆宾白
2023-03-14

您已经为python3安装安装了tkinter,但是您正在从GDB运行python3 dbg。幸运的是,解决方案很简单:为调试解释器安装tkinter(python3tk-dbg):

➜  ~ python3-dbg
Python 3.6.9 (default, Apr 18 2020, 01:56:04) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/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'
>>> 

➜  ~ sudo apt install python3-tk-dbg 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  python3-tk-dbg
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/509 kB of archives.
After this operation, 1,441 kB of additional disk space will be used.
Selecting previously unselected package python3-tk-dbg:amd64.
(Reading database ... 205251 files and directories currently installed.)
Preparing to unpack .../python3-tk-dbg_3.6.9-1~18.04_amd64.deb ...
Unpacking python3-tk-dbg:amd64 (3.6.9-1~18.04) ...
Setting up python3-tk-dbg:amd64 (3.6.9-1~18.04) ...

➜  ~ python3-dbg
Python 3.6.9 (default, Apr 18 2020, 01:56:04) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> 

 类似资料:
  • 我是新手,我写了5行tkinter,但它没有运行给错误 我的代码是 但在5小时前,它运行正常。

  • 我有一个python项目,我使用virtualenv(pipenv)设置它。我使用来创建虚拟环境,并从它们内部使用 主要的派克 我试图显示一个情节,但我得到以下错误: 文件“/home/linuxbrew/.linuxbrew/opt/python@3.8/lib/python3。8/tkinter/init。py“,第36行,在导入_tkinter中#如果这失败,您的Python可能不会为Tk

  • 我已经浏览了这方面所有类似的问题,并尝试了那里提出的解决方案。但是,我无法得到这个错误排序,虽然我的包安装在我正在使用我的项目的适当虚拟环境中。 虽然在我的项目中,我不使用tkinter,当我试图运行该文件时,我得到了以下与模块相关的错误。 回溯(最近一次调用): 文件“/usr/lib/python3.5/tkinter/init.py”,第36行,在import\u tkinter Impor

  • 嗨,我正在学习线性代数与python的Edx课程。(http://nbviewer.ipython.org/github/ULAFF/notebooks/tree/may-14-2014/). 在第一个框中的“02.4.2.10矩阵向量乘法练习”中,代码为: 生成问题是Edx教授创建的一个模块。但是,我在导入Symphy时出错。 我得到的错误如下: 我下载并安装了症状,如果我导入,它可以在终端(苹

  • 问题内容: 我正在将Django应用程序部署到开发服务器,并且在运行时遇到此错误: 似乎与一起分发。最初,我认为这可能不会安装到virtualenv中的Python,所以我使用以下命令将了(与Python相同的版本)安装到virtualenv 中的Python站点软件包: 编辑:这只发生在virtualenv内部。如果我在virtualenv外部打开控制台,则该控制台存在,但仍然出现相同的错误。

  • 问题内容: 我有这个问题: 我已经安装了PIL,但仍然无法正常工作。我使用OSX。 我正在尝试为Django Simple Captcha安装此模块。 问题答案: 克里斯托弗的建议对我来说非常有效。 详细信息如下:1.卸载现有的Python Imaging Library 下载并解压缩源版本(从此处 http://effbot.org/downloads/Imaging-1.1.6.tar.gz)