Why can't I load the _tkinter module in Python when I run this script?

I am trying to run my Python program for all users. I figured out how to run Python through a windows batch file:

@ECHO OFF
bin\python\python bin\main.py
PAUSE

      

But it gives me this error:

File "xyz/bin/python/lib/lib-tk/Tkinter.py", line 39,
in <module>
    import _tkinter
ImportError: No module named _tkinter
press any key to continue...

      

I have searched this on Google repeatedly and it said you need to install TCL / TK. So I reinstalled Python (making sure I enabled TCL / TK) and it still doesn't work. I don't have this error if I use python myself.

+3


source to share


1 answer


Try adding python libs \ path to your "PATH" variable. e.g. set PATH=c:\Python27\libs

It looks like you have installed python in some subfolders and run the bat file, which depends on where it is. Maybe your PATH environment variable is out of date Alternatively, you can tryPYTHONPATH



+1


source







All Articles