Tkinter module not found

Thomas Heller theller at python.net
Tue Aug 8 12:09:35 EDT 2006


John Salerno schrieb:
> Tim Chase wrote:
>>> The cause of this is usually that you are using a different
>>> version of Python than the one you installed Tkinter into, but
>>> being a Linux newbie I have yet to discover how to redirect
>>> the 'python' command to invoke the newer version of Python.
>> 
>> 
>> The OS looks for the first 'python' it finds in its path.
>> 
>> In Linux (or other *nix OSes), you can use
>> 
>>     bash> which python
> 
> A very helpful command to know! I'll have to wait til I get home to play 
> on Linux though. Then I can try these things you suggested.
> 
> I'm suddenly very bored here at work using Windows. :)
Well, we have python, haven't we?


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

c:\>which python
c:\util\python.EXE

c:\>which which
c:\util\which.PY

c:\>type \util\which.py
import os, string, sys
PATH = os.environ["PATH"]
PATHEXT = os.environ["PATHEXT"]

all = 0
if sys.argv[1] == "-a":
    del sys.argv[1]
    all = 1

arg = sys.argv[1]

base, ext = os.path.splitext (arg)
for path in string.split (PATH, ';'):
    if not ext:
        for extension in string.split(PATHEXT, ';'):
            if os.path.isfile(path + '\\' + arg + extension):
                print path + '\\' + arg + extension
                if not all:
                    sys.exit (0)
    else:
        if os.path.isfile (path + '\\' + arg):
            print path + '\\' + arg
            if not all:
                sys.exit (0)

c:\>


There may be better variants of which out there...

Thomas




More information about the Python-list mailing list