Linux IDLE can't import Tkinter. Your Python may not be configured for Tk
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6320954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IDLE can't import Tkinter. Your Python may not be configured for Tk
提问by breeder
I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6.
I am running Ubuntu 10.10, and I installed Python 3.2 today. The system is already running Python 2.6.
I typed idle3.2 in the terminal and it gave me:
I typed idle3.2 in the terminal and it gave me:
IDLE can't import Tkinter. Your Python may not be configured for Tk.
IDLE can't import Tkinter. Your Python may not be configured for Tk.
So I searched on Stack Overflow(and in some other places) for a solution, I installed python-tk
, I rechecked that I have tclsh
on the system, but I still can't manage to open idle3.2
.
So I searched on Stack Overflow(and in some other places) for a solution, I installed python-tk
, I rechecked that I have tclsh
on the system, but I still can't manage to open idle3.2
.
Any input would be appreciated.
Any input would be appreciated.
回答by Tnelsond
If you installed python-tk and the system is running python 2.6 then it is most likely that you installed Tkinter for python 2.6. Try installing python3-tk.
If you installed python-tk and the system is running python 2.6 then it is most likely that you installed Tkinter for python 2.6. Try installing python3-tk.
回答by Victor Dodon
you need to install tk or tk-dev packages for ubuntu.
you need to install tk or tk-dev packages for ubuntu.
回答by beibei2
On OSX, this can be resolved with macports by installing the python tkinter package for your python version. In my case, with python 2.7, I ran on the terminal:
On OSX, this can be resolved with macports by installing the python tkinter package for your python version. In my case, with python 2.7, I ran on the terminal:
sudo port install py27-tkinter
change the "27" to your python version number.
change the "27" to your python version number.
回答by Andrew
On Ubuntu:
On Ubuntu:
sudo apt-get install idle
Choose one from
Choose one from
- idle
- idle3
- idle-python2.6
- idle-python2.7
- idle-python3.1
- idle-python3.2
- idle
- idle3
- idle-python2.6
- idle-python2.7
- idle-python3.1
- idle-python3.2
for your python version.
for your python version.
回答by ronando_lu
The problem is caused by the version between python and idle not matching. U can check your python version by typing : python Then sudo aptget install the right idle version same with your python version
The problem is caused by the version between python and idle not matching. U can check your python version by typing : python Then sudo aptget install the right idle version same with your python version
回答by Stealthman
Type "idle-python2.6" in the terminal..it worked for me
Type "idle-python2.6" in the terminal..it worked for me
回答by JimK
I ran into the same error message when installing python3.4 on Fedora 20. The problem was that tk-devel was not installed during the python configure/make. The explicit steps to do this correctly are
I ran into the same error message when installing python3.4 on Fedora 20. The problem was that tk-devel was not installed during the python configure/make. The explicit steps to do this correctly are
download and extract python3.4 from python.org https://www.python.org/downloads/
download and extract python3.4 from python.org https://www.python.org/downloads/
Find and install the right tkinter and tk-devel:
Find and install the right tkinter and tk-devel:
yum search tkinter
yum search tkinter
yum install python3-tkinter-3.3.2-17.fc20.x86_64
yum install python3-tkinter-3.3.2-17.fc20.x86_64
yum search tk-devel
yum search tk-devel
yum install tk-devel.x86_64
yum install tk-devel.x86_64
AFTER these are onboard, cd into the python3.4 package directory and run the configure; make, make install process.
AFTER these are onboard, cd into the python3.4 package directory and run the configure; make, make install process.
I spent too much time resolving this issue. Hopefully this post will help may others to a quick resolution.
I spent too much time resolving this issue. Hopefully this post will help may others to a quick resolution.
PS stackoverflow is awesome. If google brought you to this article, spend some time and surf around the site.
PS stackoverflow is awesome. If google brought you to this article, spend some time and surf around the site.
回答by artemis_clyde
On my arch linux system I had the same problem easily solved by typing
On my arch linux system I had the same problem easily solved by typing
yaourt tkinter
and installing the first package community/python-pmw 2.0.1-2 [installed]
and installing the first package community/python-pmw 2.0.1-2 [installed]