CentOS install Python 2.7

9

I wrote a bash script to install and compile Python 2.7 from source on my CentOS 5.5 x86_64 server. My  source of inspiration was an article from Villa Road.

 

 

Enjoy!

9 Comments

  1. I’m having some trouble with this script.
    First of all the python alias doesn’t work. Only the python2.7 does work.
    Second of all when installing twisted/fabric or anything else that requires gcc to install itself it fails with the following message:

    gcc -pthread -shared build/temp.linux-x86_64-2.7/twisted/runner/portmap.o -L. -lpython2.7 -o build/lib.linux-x86_64-2.7/twisted/runner/portmap.so
    /usr/bin/ld: cannot find -lpython2.7
    collect2: ld returned 1 exit status
    error: command ‘gcc’ failed with exit status 1

    Can anyone help me solve this?

  2. @Omer Katz – not sure if you’re still having that issue (it has been months), but I just experienced the same problem. Adding this symlink fixed it for me:

    ln -sf /opt/python2.7.1/lib/libpython2.7.so /usr/lib/libpython2.7.so

  3. @Brandon – Thanks! that worked perfectly for me. I had followed the tutorial from Villa Road so, I just changed the python2.7.1 to python2.7

  4. Pingback: Another Python/Mercurial/mod_wsgi on CentOS HOWTO – 2/2 | Kev's Big Log

  5. @Brandon – thanks, that symlink did the trick for me too.

    I had tried adding my python lib path (/usr/local/python2.7.2/lib) to /etc/ld.so.conf and running ldconfig, but the psycopg2 install still couldn’t find -python2.7.

  6. Pingback: How to install Python 2.7.1 on CentOS. | Photo & Life Style.

Leave a Reply