-3

I am unable to digest the fact that Linux CentOS requires users to do so much just for installing Python. It was so easy installing python on Ubuntu.

Also since CentOS comes with python2.5 it leads me to believe that it is not made for python specific usage.

But in case of centos i need to wget then tar then install. It does so much at back that I dont even know whats going wrong in it.

Is there a package installer for CentOS which can install python2.7, python 3.4 as easily as in ubuntu?

  • No version of CentOS comes with python 2.5. – jordanm Jul 17 '15 at 16:27
  • Python is a core part of Red Hat Enterprise Linux, and thus a core part of CentOS. A lot of the Red Hat-specific parts of the OS is written in Python, as is the installer. The only tricky bit about using Python on RHEL type OSes is using a different version than it shipped with, since replacing such a core component has consequences. This is why the IUS repos mentioned in jordanm's answer name the alternate Pythons differently. – Warren Young Jul 17 '15 at 16:53
  • @WarrenYoung this is no different from another distro such as Ubuntu, Debian. You can't change the default version and expect things to continue to work. – jordanm Jul 17 '15 at 16:54
  • I just installed Python 3.4 on CentOs 7 with this tutorial: Digital Ocean: Setup Python on CentOs. It has easy to follow instructions with helpful warnings and links to explanations of what's going on when you run the commands. Hope this helps! – user123921 Jul 17 '15 at 20:09
-1

Any luck through YUM command?

Below command can give you more information about python packages along with versions that are installed & available as updates.

yum list python --showduplicates

If you find any package with version that meets your need, then install it by:

yum install python-<version>
  • it only gives python 2.6.6 as available and installed – pg2455 Jul 17 '15 at 16:50
  • its a pain in the *** to install python on centos – pg2455 Jul 17 '15 at 16:51
7

All versions of CentOS come with python pre-installed. Version 5 has python 2.4, 6 has 2.6, and 7 has 2.7. If you need python 2.7 on an old version of CentOS, you can use the IUS repos.

To use the repo, you need to install the release RPM for your version of CentOS. For CentOS 6:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-14.ius.centos6.noarch.rpm

Once the repo is setup, you can use yum to install the alternate versions of python:

yum install python27 python34

Note that this does not change the default version of python. It is an alternate installation, so you need to specify python27 or python34 to use them.

  • i need python 2.7 and python 3.4 on centOS 6 – pg2455 Jul 17 '15 at 16:40
  • @mousecoder both are available in the IUS repo. – jordanm Jul 17 '15 at 16:43
  • I see. Can you also tell me the how to use the IUS repo. basically commands to get IUS repo and use it to install python – pg2455 Jul 17 '15 at 16:49
  • @mousecoder updated – jordanm Jul 17 '15 at 16:52
  • I am getting this error: Retrieving https://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-14.ius.centos6.noarch.rpm warning: /var/tmp/rpm-tmp.UTsZzB: Header V4 DSA/SHA1 Signature, key ID 9cd4953f: NOKEY error: Failed dependencies: epel-release = 6 is needed by ius-release-1.0-14.ius.centos6.noarch – pg2455 Jul 17 '15 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.