You are not logged in.

#1 2014-05-25 22:36:02

ishwagakill
Member
Registered: 2014-05-25
Posts: 1

Python: Tkinter does not work

As the title says, Tkinter does not work even though I have it installed.

[ishwagakill@arch ~]$ python Tkinter_file.py
Traceback (most recent call last):
  File "Tkinter_file.py", line 1, in <module>
    import Tkinter
  File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter

Notes:
-------------------
Am using Python 2.7.6


sudo pacman -S tk 

Does not solve the problem

Offline

#2 2014-05-26 00:33:33

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: Python: Tkinter does not work

So, you've changed the python symlink?

Offline

#3 2014-05-27 15:47:19

mike_r
Member
Registered: 2009-01-22
Posts: 114

Re: Python: Tkinter does not work

A few comments:

Invoking python with "python" should call up python3.4; if you intend python2.7, I think you need to use python2 on the command line. (Warning: I use python3 almost exclusively, so I don't know exactly what happens if you have only python2 installed, if that is even possible.)

Then, why is the path to tkinter in /usr/local/...? It should be in /usr/lib/python2.7/... to make any sense.

Last, do you have tcl/tk installed? It's not a hard requirement for python, only optional, so if you want to use tkinter, you need to install tk explicitly.


Linux User #353 - SLS -> Slackware -> Red Hat -> Mandrake -> Fedora -> Arch

Offline

Board footer

Powered by FluxBB