[英]Module tkinter working with python 3.5, but not python 3.6
我在Ubuntu 16.04上,剛剛安裝了python 3.6。 通過apt
。 import
tkinter
,我經常看到錯誤
ImportError: No module named '_tkinter', please install the python3-tk package
麻煩的是, 已安裝python3-tk
軟件包。
$> python3.5 -c "import tkinter"
[no output]
$> python3.6 -c "import tkinter"
Traceback (most recent call last):
File "/usr/lib/python3.6/tkinter/__init__.py", line 37, in <module>
import _tkinter
ModuleNotFoundError: No module named '_tkinter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.6/tkinter/__init__.py", line 39, in <module>
raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package
我怎樣才能解決這個問題?
我通過從備份還原/usr/lib/python3.6
解決了這個問題。 我現在已經看到它好幾次了,當那里缺少東西時,包管理器無法重裝它,盡管聲稱這樣做了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.