Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>>
on the other hand...
Python 3.2 (r32:88445, Mar 25 2011, 19:28:28)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Tkinter
I checked synaptic, Tkinter is installed. Then I found this--
If it fails with "No module named _tkinter", your Python configuration needs to be modified to include this module (which is an extension module implemented in C). Do not edit Modules/Setup (it is out of date). You may have to install Tcl and Tk (when using RPM, install the -devel RPMs as well) and/or edit the setup.py script to point to the right locations where Tcl/Tk is installed. If you install Tcl/Tk in the default locations, simply rerunning "make" should build the _tkinter extension.
I am guessing that tkinter is still associated with the old python in my pc. How do I change that so python3 can use tkinter?
Since you mention synaptic I think you're on Ubuntu. You probably need to run update-python-modules to update your Tkinter module for Python 3.
EDIT: Running update-python-modules
First, make sure you have python-support
installed:
sudo apt-get install python-support
Then, run update-python-modules
with the -a
option to rebuild all the modules:
sudo update-python-modules -a
I cannot guarantee all your modules will build though, since there are some API changes between Python 2 and Python 3.