Python 3. No module named _tkinter(solved)

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post please read this

Python 3. No module named _tkinter(solved)

Postby RETNUH on Wed Nov 02, 2011 2:31 pm

Code: Select all
      python3
Python 3.2.2 (default, Nov  2 2011, 03:07:17)
[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>
  File "/usr/local/lib/python3.2/tkinter/__init__.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter


I have installed Python3 and Python3-Tk
I have followed the steps here, however I don't know how to edit the paths and such like it says to do.

I got on the python IRC and found that i messed something up by installing python3 from a tarball.
The lesson? Use the package manager whenever possible.
Last edited by RETNUH on Fri Nov 11, 2011 3:38 pm, edited 1 time in total.
We all know that light travels faster than sound. That's why certain people appear bright until you hear them speak. -Albert Einstein

Formerly known as Luckydog.

Looking for me? Check the IRC I've been hanging out there.
User avatar
RETNUH
Level 4
Level 4
 
Posts: 450
Joined: Fri Jul 15, 2011 10:55 pm
Location: Nebraska, USA

Linux Mint is funded by ads and donations.
 

Re: Python 3. No module named _tkinter

Postby DrHu on Wed Nov 02, 2011 4:34 pm

http://wiki.python.org/moin/TkInter
    This has the same syntax as the shell variable PATH, that is, a list of directory names. When PYTHONPATH is not set, or when the file is not found there, the search continues in an installation-dependent default path; on Unix, this is usually .:/usr/local/lib/python.
    It is the subdirectory named "lib-tk" of the Python library directory (when using Python 1.4 or before, it is named "tkinter").
In the terminal locate the python program
Code: Select all
locate python
--to find your file mane
PYTHONPATH=
--to add that location to the variable for the python program

--add that file directory (folder) to the shell (bash ) variable PYTHONPATH, this is a work-around to enable you to install the program tkinker you are attempting

Just make sure to use the correct directory (folder) making sure of the number of / (forward slashes, Linux directory separator character, similar to the \ (backslash for windows)

The file you are looking for is lib-tk if you have a version of python after 1.4 (the version number..)
--if your pyhton is pre version 1.4, the file name will be tkinker

<EDIT>..In your guide, sorry I should read more carefully, you are using python 3x..
--step 2 did work correctly or not (module for tkinker ?)
OK, I see the part that failed for you was step 2, import tkinker
    So, just setup PYTHONPATH for lib-tk and see if that then works for the installation..
...and change the terminal search to lib-tk
User avatar
DrHu
Level 15
Level 15
 
Posts: 5889
Joined: Wed Jun 17, 2009 8:20 pm

Re: Python 3. No module named _tkinter

Postby RETNUH on Fri Nov 04, 2011 8:33 pm

Neither steps 1 or 2 work.

Also i found i have tkinter installed here /usr/lib/python3.2/tkinter
also the python3-tk properties say this
Code: Select all
/.
/usr
/usr/lib
/usr/lib/python3
/usr/lib/python3.1
/usr/lib/python3.1/lib-dynload
/usr/lib/python3.1/lib-dynload/_tkinter.so
/usr/lib/python3.2
/usr/lib/python3.2/lib-dynload
/usr/lib/python3.2/lib-dynload/_tkinter.cpython-32mu.so
/usr/share
/usr/share/doc
/usr/share/doc/python3-tk
/usr/share/doc/python3-tk/README.Debian
/usr/share/doc/python3-tk/README.Tk
/usr/share/doc/python3-tk/changelog.Debian.gz
/usr/share/doc/python3-tk/copyright


Also when I try "import tkinter" from IDLE it just doesn't do anything.

Also there isn't a "lib-tk" anywhere.

These are the python folder in usr/lib
Attachments
python stuff.png
python stuff.png (12.27 KiB) Viewed 842 times


Last bumped by RETNUH on Fri Nov 04, 2011 8:33 pm.
We all know that light travels faster than sound. That's why certain people appear bright until you hear them speak. -Albert Einstein

Formerly known as Luckydog.

Looking for me? Check the IRC I've been hanging out there.
User avatar
RETNUH
Level 4
Level 4
 
Posts: 450
Joined: Fri Jul 15, 2011 10:55 pm
Location: Nebraska, USA


Return to Other topics

Who is online

Users browsing this forum: justy39 and 2 guests