英文:
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:
>>> 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
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论