Install python 2.6 on CentOS

I have a shell that runs CentOS.

For the project I'm doing, I need python 2.5+, but centOS is pretty dependent on 2.4.

From what I read, some things will break if you switch to 2.5.

I want to install 2.5 separately from 2.4, but I'm not sure how to do this. While I downloaded the original tarball, unpacked it and made ./configure --prefix=/opt , where I want it to finish. Can I now just make, make install ? Or is there more?

+83
python centos rpath
Sep 23 '09 at 9:53
source share
14 answers

You can also use the EPEL repository and then sudo yum install python26 install python 2.6

+77
Nov 08 '10 at 8:13
source share

Try epel

 wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm sudo rpm -ivh epel-release-5-4.noarch.rpm sudo yum install python26 

The python executable will be available in /usr/bin/python26

 mkdir -p ~/bin ln -s /usr/bin/python26 ~/bin/python export PATH=~/bin:$PATH # Append this to your ~/.bash_profile for persistence 

Now the python command will execute python 2.6

+31
Dec 02 2018-11-11T00:
source share

When I encounter such situations, I generally avoid the package manager, especially if it would be awkward to break something, i.e. production server. Instead, I would go to Activestate and download their binary package:

https://www.activestate.com/activepython/downloads/

This is installed when you run a script that puts everything in a folder and does not touch any system files. In fact, you don’t even need root privileges to configure it. Then I change the name of the binary to something like apy26, add this folder to the end of PATH and start encoding. If you install packages using apy26 setup.py install , or if you use virtualenv and easyinstall, then you will have the same flexible python environment you need without touching the system standard python.

edits ... Recently, I did some work to create a portable binary Python for Linux, which should work on any distribution without external dependencies. This means that any binary shared libraries needed by the portable Python module are part of the assembly included in tarball and installed in the Python private structure. This way you can install Python for your application without interfering with the installed Python system.

My github site has a build script that has been thoroughly tested on Ubuntu Lucid 10.04 LTS on both 32 and 64 bits. I also built it on Debian Etch, but it was a long time ago, and I can not guarantee that I have not changed anything. The easiest way to do this is to simply put your choice of Ubuntu Lucid in a virtual machine, check the script on git clone git://github.com/wavetossed/pybuild.git , and then run the script.

Once you build it, use tarball on any latest Linux distribution. There is one small wrinkle moving it to a directory other than /data1/packages/python272 , which is that you must run the included patchelf to set the interpreter path BEFORE the directory engine. This affects any binaries in /data1/packages/python272/bin

All of this is based on building with RUNPATH and copying dependent shared libraries. Despite the fact that the script is in several files, it is actually one long script shell, located in the style of the / etc / rc.d directories.

+28
Oct. 16 '09 at 21:24
source share

No, it is. You might want to make sure that you have all the additional library headers, so you don't have to recompile them later. They are listed in the documentation, I think.

In addition, you can install it even in the standard path if you do make altinstall . This way it will not override your current "python" by default.

+24
Sep 23 '09 at 10:08
source share

No need to do yum or create your own RPM. Build python26 from source.

 wget https://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz tar -zxvf Python-2.6.6.tgz cd Python-2.6.6 ./configure && make && make install 

There may be a dependency error to use

 yum install gcc cc 

Add the installation path ( /usr/local/bin/python by default) to ~/.bash_profile .

It will not break yum or any other things that depend on python24 .

+24
Feb 15 2018-11-11T00:
source share

Chris Lea provides the YUM repository for the python26 RPM, which can coexist with the native 2.4, which is required by several administrators of CentOS tools.

Quick instructions that worked for me at least:

 $ sudo rpm -Uvh http://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm $ sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL $ sudo yum install python26 $ python26 
+12
Sep 30 '09 at 13:18
source share

If you want to make it easier for yourself, there is CentOS RPM for newer versions of Python floating around the web. For example. cm:

http://www.geekymedia.com/python_26_centos.html

+3
Sep 23 '09 at 10:02
source share

When you install your version of python (in this case python2.6), then run this command to create your virtualenv :

 virtualenv -p /usr/bin/python2.6 /your/virtualenv/path/here/ 
+3
Jul 09 '14 at 9:02 on
source share

Late to the party, but the OP had to go with Buildout or Virtualenv and completely fix the problem.

I'm currently working on a Centos server, well, I would say that would be a suitable term, and I can assure everyone that the only way I can blink from tears using the software equivalents of refractory lances is buildout,

+2
May 6 '10 at 9:32 a.m.
source share
+1
Dec 30 '09 at 15:26
source share
+1
Jan 22 2018-11-11T00:
source share
 rpm -Uvh http://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL rpm -Uvh ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/libffi-3.0.5-1.el5.kb.i386.rpm yum install python26 python26 

for dos that just don't know: =)

+1
Mar 12 '11 at 15:59
source share
 # yum groupinstall "Development tools" # yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel 

Download and install Python 3.3.0

 # wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2 # tar xf Python-3.3.0.tar.bz2 # cd Python-3.3.0 # ./configure --prefix=/usr/local # make && make altinstall 

Download and install Distribute for Python 3.3

 # wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz # tar xf distribute-0.6.35.tar.gz # cd distribute-0.6.35 # python3.3 setup.py install 

Install and use virtualenv for Python 3.3

 # easy_install-3.3 virtualenv # virtualenv-3.3 --distribute otherproject New python executable in otherproject/bin/python3.3 Also creating executable in otherproject/bin/python Installing distribute...................done. Installing pip................done. # source otherproject/bin/activate # python --version Python 3.3.0 
+1
Jul 15 '13 at 11:14
source share

I did not understand the original version of python (2.6.6) and installed 2.7 (with the make && make altinstall ), but when I tried to install something with yum, it did not work.

So, I solved this problem as follows:

Done

0
Jul 03 '13 at 0:31
source share



All Articles