Tkinter抛出ImportError。

huangapple go评论64阅读模式
英文:

Tkinter throws ImportError

问题

我试图在Python中制作我的第一个Tkinter项目,但它只显示给我这个错误信息:

>>> from tkinter import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/tkinter/__init__.py", line 38, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
    ^^^^^^^^^^^^^^^
ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

我正在使用Arch。

我尝试过pip install tkinter,但没有帮助。

请帮忙。

英文:

I was trying to make my first Tkinter project in Python but it just shows me this:

&gt;&gt;&gt; from tkinter import *
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/lib/python3.11/tkinter/__init__.py&quot;, line 38, in &lt;module&gt;
    import _tkinter # If this fails your Python may not be configured for Tk
    ^^^^^^^^^^^^^^^
ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

I am using Arch.

I have tried pip install tkinter but it didn't help.

Pls help

答案1

得分: 2

尝试运行 # pacman -S tk,我遇到相同的问题,这解决了它。

英文:

Try # pacman -S tk I had the same problem and that fixed it.

huangapple
  • 本文由 发表于 2023年6月19日 02:28:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76502018.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定