Issues installing Python 2.7
rosuav at gmail.com
Thu Nov 27 00:47:21 CET 2014
On Thu, Nov 27, 2014 at 4:09 AM, <billyfurlong at gmail.com> 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 http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz
> 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 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: libpython2.7.so.1.0: 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 ld.so.conf (or ld.so.conf.d
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
More information about the Python-list