Python – _tkinter module not found

pythonpython-3.xtkinter

I know you are going to say this is a duplicate but it really isn't. Im getting the error:

Traceback (most recent call last):
File "calculator.py", line 1, in <module>
from tkinter import *
File "/usr/local/lib/python3.4/tkinter/__init__.py", line 38, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named '_tkinter'

I have gone through ALL errors and solutions given on EVERY site including this one I have
Updated my OS to the latest system
installed tkinter
installed python-tk
installed python3-tk
installed tk-dev
installed tcl
installed EVERYTHING and yet i still get the error. it's driving me nuts,I'm trying to learn how to make a GUI so my scripts can be more helpful to the people who cant figure out command line scripts. But if none of my practice scripts work then I cant do anything. this is the script I'm running if you want to see it. nothing special.

from tkinter import *

def iCalc(source, side):
    storeObj = Frame(source, borderwidth=4, db=4, bg="red")
    storeObj.pack(side=side, expand=YES, fill=BOTH)
    return storeObj

def button(source, side, text, command=None):
    storeObj = Button(source, text=text, command=command)
    storeObj.pack(side=side, expand=YES, fill=BOTH)


class app(Frame):
    def __init__(self):
        Frame.__init__(self)
        self.option_add('*Font', 'arial 20 bold')
        self.pack(expand=YES, fill=BOTH)
        self.master.title('Calculatorinator')


        display = StringVar()
        Entry(self, relief=RIDGE,
            textvariable=display, justify='right', bd=30, bg="red").pack(side=TOP, expand=YES,
                fill=BOTH)

    for clearBut in (["CE"], ["C"]):
            erase=iCalc(self, TOP)
            for ichar in clearBut:
                button(erase, LEFT,ichar,
                       lambda storeObj=display, q=ichar:storeObj.set(''))

    for NumBut in ("789/", "456*", "123-", "0.+"):
        FunctionNum = iCalc(self, TOP)
        for char in NumBut:
            button(FunctionNum, LEFT, char,
                lambda storeObj=display, q=char: storeObj.set(storeObj.get() + q))

    EqualsButton = iCalc(self, TOP)
    for iEquals in "=":
        if iEquals == '=':
            btniEquals = button(EqualsButton, LEFT, iEquals)
            btniEquals.bind('<ButtonRelease-1>',
                lambda e, s=self, storeObj=display: s.calc(storeObj), '+')
        else:
            btniEquals = button(EqualsButton, LEFT, iEquals,
                lambda storeObj=display, s=' %s '%iEquals: storeObj.set(storeObj.get()+s))

if __name__ == '__main__':
    app().mainloop()

UPDATE: Now it wont even let me run idle: idle3.4
** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **

Best Answer

This part of the backtrace indicates that tkinter is being loaded from /usr/local/lib/python3.4

File "/usr/local/lib/python3.4/tkinter/__init__.py", line 38, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk

i.e. tkinter has been manually installed (not through a package manager) to /usr/local/lib/python3.4

But this suggests you have installed python and tkinter using package manager.

Updated my OS to the latest system installed tkinter installed python-tk installed python3-tk

I think you may have to remove tkinter installed to /usr/local/lib/python3.4/tkinter if you have tkinter also installed as a package (ubuntu package?), or rename the directory and do some testing.