linux - python 3 没有名为 _tkinter 的模块

标签 linux python-3.5

我一直在搜索它,但在网上找不到关于这个主题的任何内容。

当我在 python 3.5 中开发导入 tkinter 或 pyglet 的程序时,我完全能够从我的 Linux Mint 安装上的命令行启动它。一旦我尝试从 pycharm 或 Visual Studio Code 启动它,我就会收到错误消息。

它用于 tkinter:

Traceback (most recent call last):  File "/home/b...", line 3, in <module>
    import tkinter as tk
  File "/usr/lib/python3.5/tkinter/__init__.py", line 35, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named '_tkinter'

tkinter 和 pyglet 脚本在从 idle3(使用 F5)启动时都在工作。

谁能帮帮我?

最佳

B.

最佳答案

我遇到了同样的问题。问题在于 Linux Mint 软件管理器。如果你的 vs 代码是通过软件管理器安装的,它将安装在 Flatpak 虚拟沙箱中。只需从其主页下载并运行 vs code 即可。

关于linux - python 3 没有名为 _tkinter 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48841804/

相关文章:

python - 如何让python脚本在系统启动15分钟后运行?

python - sqlite3.操作错误: table test has no column named

android - Cocos2D-Python 到 Android/iOS

python - 求a到b范围内函数下的面积

linux - 以特定方式启动终端?

Python 脚本不会在 Linux 上创建文本文件

linux - 在 cd 后执行 ls 的脚本

c - 在 Unix 上查找已编译库的依赖项

python - subprocess.run : Is it safe to combine check=True with stdout=PIPE?

python - 属性错误 : module 'tkinter' has no attribute 'tk'