Fra*_*urt 2 python software-installation tkinter
如何为 python 3.4 和 python 3.5 安装 tkinter?
目前,tkinter 是为 python 3.4 安装的(即import tkinter在 python 3.4 解释器中运行良好)。但是我不知道如何为 python 3.5 安装 tkinter。
sudo apt-get install python3-tk不起作用:它说python3-tk已经安装(这并不奇怪,因为它是为 python 3.4 安装的)。
我使用 Ubuntu 14.04.4 LTS x64。
python3.4:
jh@gr:/scratch/test$ python3.4
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>
Run Code Online (Sandbox Code Playgroud)
python3.5:
jh@gr:/scratch/test$ python3.5
Python 3.5.2 (default, Jul 17 2016, 00:00:00)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/__init__.py", line 36, in <module>
import _tkinter
ImportError: No module named '_tkinter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/tkinter/__init__.py", line 38, in <module>
raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package
Run Code Online (Sandbox Code Playgroud)
作为旁注,重新安装包python3-tk不会改变情况(即,之后tkinter在 python 3.4 中工作,而不是在 python 3.5 中):
sudo apt-get remove python3-tk
sudo apt-get install python3-tk
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24408 次 |
| 最近记录: |