How to install python on clean RH7.1 install

Joal Heagney s713221 at
Sat Jun 23 03:25:57 CEST 2001

Ken wrote:
> Hi,
> I'm trying to install Python 2.1-5 onto a newly installed RH7.1.  The
> RH install was done pretty cleanly, so not a lot of the RPMs have been
> installed (I've installed some along the way, as dependencies came
> up).
> My quesions are these:
> 1).  Is it possible to "upgrade" the python 1.5.2 that is installed
> with RH7.1?  (I couldn't easily avoid installing it - because it was a
> dependency for a lot of packages.  That said, I cannot easily
> uninstall the RPM for 1.5.2).
> 2).  If not, what way is more or less a fail-safe way of installing
> python into a new directory.  I have tried the following already:
> - installing from the src.rpm file -- the installer stopped short of
> creating the RPM file... something about it not finding a lot of files
> (that it was to have compiled).  It made it through the check, and did
> about 5 minutes of compiling, then stopped.
> - installing from the rpm file.  The dependencies failed were
> libcrypto, and libssl -- but I have NO idea where to find these
> (preferrably RPMs).
> Any ideas would be greatly appreciated!
> Kc

Question 1.
To find out which packages require python, use the following command:
rpm -q --whatrequires python

I haven't tried to replace python1.5 in a distro, prefering to install
python2.1 beside the system python, but if I were going to do this, I'd
install python2.1 either from the source using --altinstall rather than
--install, with --prefix=/usr during the configure step, or build and
install python2 from any of the python2*src.rpm files out there.

This will install python2 under /usr, but your /usr/bin directory will
(or should) look like this (for the python2.src.rpm option)
-rwxr-xr-x    1 root     root       423260 Oct  1  2000 python ->
-rwxr-xr-x    1 root     root       423260 Oct  1  2000 python1.5
-rwxr-xr-x    2 root     root       521020 Jun 15 20:39 python2 ->
-rwxr-xr-x    2 root     root       521020 Jun 15 20:39 python2.1

Then I'd get all the packages that depend on python1.5, preferably in
src.rpm form. Go to /usr/bin and swap around the default python
cd /usr/bin
mv python python-old
ln -s python2.1 python
and build each of the dependancies packages, but don't install them.
Fix the hacking you did on the /usr/bin directory
rm python
mv python-old python
Then rebuild the python2 src.rpm but edit the spec file so that it build
python2 as the package python
rpm -i python2*src.rpm
cd /usr/src/RPM/SPECS
emacs python.spec
(Focus on the first 5 to 8 lines, and save the file)
rpm -bb python.spec
cd /usr/src/RPM/RPMS/i386
rpm -i python<version>.rpm <plus all your other packages>

If things stuff up, you may have to go back to your old packages. Cd to
your CD, and 
rpm -U --oldpackage python<oldpythonversion>.rpm <plus all your other
old packages>

In fact, if you're worried, I'd build all your dependancies packages
from source (Which you can retrieve from your src.rpm packages after you
install them.), making sure they go into python2.1, test each one out,
and then do what I suggested above.

What you have to ask, is it worth it? Will a coexistant install do what
you require with far less effort than a total replace?

Question 2. 
You need to install the development packages of crypto and ssl, they'll
be on your cd. Also, install the readlines development library before
your build. With this, python will install readlines into the binary,
and when you're working in interactive mode, you'll be able to repeat
any of your previous commands by tapping the up-down arrows (Like
xterm/bash, as opposed to the _ trick, which only repeats the last
command.) This also goes for any other modules that you want, but will
probably require system libraries to build. (Read the python
documentation for hints as to this.)
      Joal Heagney is: _____           _____
   /\ _     __   __ _    |     | _  ___  |
  /__\|\  ||   ||__ |\  || |___|/_\|___] |
 /    \ \_||__ ||___| \_|! |   |   \   \ !

More information about the Python-list mailing list