Issues installing Python 2.7

Chris Angelico rosuav at
Thu Nov 27 00:47:21 CET 2014

On Thu, Nov 27, 2014 at 4:09 AM,  <billyfurlong at> wrote:
> Hi all,
> Not a python user but I'm trying to upgrade python so I can install pip which is required for one of the apps that I'm installing.
> I've tried to install using the below instructions, but when I type python I still get the old 2.4.3 version.  Oh Red Hat 5.8 is where I'm installing on.

Since RHEL depends on Python's stability, you'll continue to get the
old version when you just type 'python'. Changing that would
potentially break hundreds of scripts in your system. You're
definitely going to have to type 'python2.7' to get the new version.

> yum groupinstall "development tools" -y
> yum install readline-devel openssl-devel gmp-devel ncurses-devel gdbm-devel \
> glib-devel expat-devel libGL-devel tk tix gcc-c++ \
> libX11-devel glibc-devel bzip2 tar tcl-devel tk-devel pkgconfig \
> tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel \
> valgrind-devel -y
> mkdir tmp
> cd tmp
> wget
> tar xvfz Python-2.7.5.tgz
> cd Python-2.7.5

Hmm, you just grabbed 2.7.5, but there's a 2.7.8 (and 2.7.9 is in RC,
coming soon). I don't think it'll make much difference here, but you
may as well grab the latest stable.

> ./configure --prefix=/opt/python2.7 --enable-shared
> make
> make altinstall

It's been a while since I built a Python 2 from source, but I suspect
'make altinstall' is safe, and the --prefix to configure is
unnecessary. However... my suspicion is that you simply need to
reference the shared library from the same directory.

> Add this to the bashrc
> export PATH=$PATH:/opt/python2.7/bin/
> [root at wmy machine bin]# python2.7
> python2.7: error while loading shared libraries: cannot open shared object file: No such file or directory

See if that file exists somewhere in /opt/python2.7 - if it does, you
may simply need to add that directory to (or
if that's how your system's set up) and rerun ldconfig.

Alternatively, you should be able to run Python directly from the
build tree. If that works, you know for sure that it's a simple
pathing problem.


More information about the Python-list mailing list