install python 2.7 , gevent on centos 5 x86_64

Posted: 4th August 2010 by admin in Linux How to
yum install gcc gcc-c++.x86_64 compat-gcc-34-c++.x86_64 openssl-devel.x86_64 zlib*.x86_64

install python 2.7

wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
tar -xvjf Python-2.7.tar.bz2
cd Python*
./configure --prefix=/opt/python27
make
make install
vi ~/.bash_profile

replace PATH=$PATH:$HOME/bin
with PATH=$PATH:$HOME/bin:/opt/python27/bin

reload .bash_profile

source ~/.bash_profile
echo "/opt/python27/lib" > /etc/ld.so.conf.d/python27.conf
ldconfig

install setuptool

cd ~
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg

install gevent

yum install libevent.x86_64 libevent-devel.x86_64
easy_install-2.7 greenlet
wget http://pypi.python.org/packages/source/g/gevent/gevent-0.13.0.tar.gz
tar -xvzf gevent-0.13.0.tar.gz
cd gevent*
python2.7 setup.py install
  1. faq bay says:

    Are you sure this won\\\’t break any CentOS dependencies? I need Python => 2.5 installed but I\\\’m a bit afraid that this will break my other packages. Is there any way I could update using yum?

  2. admin says:

    yes of course

  3. fenderbirds says:

    nice article, keep the posts coming

  4. Rodrigo Ferrari says:

    Hello my friend, thanks for your how to.

    I\\\\\\\\\\\\\\\’m getting this error:
    Traceback (most recent call last):
    File \\\\\\\\"<string>\\\\\\\\", line 1, in <module>
    zipimport.ZipImportError: can\\\\\\\\\\\\\\\’t decompress data; zlib not available

    When I try to run sh setuptools-0.6c11-py2.7.egg

    Is there any help?

    Thanks!

  5. admin says:

    i think u not have a zlib package
    u can install it with this command “yum install zlib.x86_64 zlib-devel.x86_64″

  6. kreed says:

    many thanks, worked for me, running centos 5.5 final 64 bit

  7. [...] Theres a great tutorial on installing Python 2.7 on CentOS 5 here. [...]

  8. Khoi Doan says:

    It’s usefull. Thanks for posting!

  9. James says:

    Thank you for this. It saved me a lot of time. it would be nice if you added “-y” to your yum install lines. Also instead of calling vi just running “export PATH=${PATH}:/opt/python27/bin” so that this was a little more copy/paste friendly.

    Alternatively, you could use sed to edit the bash_profile. Thank you again. Really a time-saver.

  10. James says:

    Thank you for this. It saved me a lot of time. it would be nice if you added \\"-y\\" to your yum install lines. Also instead of calling vi just running \\"export PATH=${PATH}:/opt/python27/bin\\" so that this was a little more copy/paste friendly.

    Alternatively, you could use sed to edit the bash_profile. Thank you again. Really a time-saver.

  11. Lexus says:

    What a joy to find such clear thinikng. Thanks for posting!

  12. tom green says:

    awesome tutorial, very well done.

  13. Alex Quinn says:

    Thank you!

  14. Falak says:

    Good tutorial. I want to compile and install plivo (an open source communication framework) after the installation of gevent. What commands i have to run. (I am newbie on centos). Following are the links for plivo:
    git://github.com/plivo/plivo.git
    https://github.com/plivo/plivo/raw/master/scripts/ez_setup.py

    Similarly, if i have above distributions on my local drive, how I would compile and install them?

  15. Bilal says:

    Thanks a lot, it was very helpful
    using
    ./configure
    instead of
    ./configure –prefix=/opt/python27
    will give run python2.7 on default script python

*
Security Code: