Help uninstalling/installing Python 2.4

Craig Ringer craig at postnewspapers.com.au
Sat Jan 8 00:40:40 EST 2005


On Sat, 2005-01-08 at 08:08, Baggs wrote:

> Tk calls did not work, the output from Python when running a program 
> stated that I probably did not have TK installed.  I got and installed 
> TK 8.4 and the problem persisted (I know I should have written down the 
> exact error, but I didn't... but the story gets worse!)

You probably didn't have the -devel packages for Tcl and Tk installed,
so Python would've decided you didn't have Tk and not built tkinter
support. Chances are if you install the devel packages and recompile
Python, it'll work fine.

> when I re-installed I still have 
> problems.. everything installs ok, but now I get the following errors 
> with Python...
> 
> bash: /usr/bin/python: No such file or directory

Is that when you run a script, or when you type 'python' in your shell?
If the former, make sure you write your scripts with a #! like this:

#!/usr/bin/env python

not

#!/usr/bin/python

That way, the right python will get run so long as it's on your path -
it doesn't have to be in /usr/bin.

If the error is when typing 'python' on the command line, ensure you
have no aliases for the name 'python' hanging around ('alias python' to
find out). Also check what is actually being run with 'which python' and
see if it's a wrapper script that calls /usr/bin/python.

> when I go to /usr/local/bin and type ./python I get
> 
> Python 2.4 (#6, Jan  7 2005, 18:44:57)
> [GCC 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> Traceback (most recent call last):
>    File "/etc/pythonrc.py", line 2, in ?
>      import readline
> ImportError: No module named readline
> 
> I think some paths are screwed up.. can someone take pity on me and give 
> me a hand.

I'd say that'll be the same as with Tkinter - you probably didn't have
the GNU readline development headers installed, so Python disabled
readline support when it was compiled. That's just a guess, but seems
pretty likely.

--
Craig Ringer




More information about the Python-list mailing list