Install Python 3 on CentOS 7
Install Python 3 on CentOS 7
Table of Contents
Introduction
SoftwareCollections.org is a community project built around Red Hat Enterprise Linux, Fedora, CentOS, and Scientific Linux that allows installing and running multiple versions of software on a single system. The available collections typically include newer versions of programming languages and services.
This tutorial will describe setting up Software Collections (SCLs) in CentOS 7 and installing Python 3.3 along side the Python 2.7 distribution default.
Requirements
- CentOS 7 or Red Hat Enterprise Linux 7
Install Software Collections
The first step is to install the utilities needed to manage collections.
yum -y install scl-utils
The next step is to identify which software collection you want and to install the associated repository. A full list of available collections can be found at the following URL.
The Python33 collection repository package can be installed directly using RPM.
rpm -Uvh https://www.softwarecollections.org/en/scls/rhscl/python33/epel-7-x86_64/download/rhscl-python33-epel-7-x86_64.noarch.rpm
Install Python 3
The Python 3 collection can now be installed using YUM.
yum -y install python33
Use Python 3
Python 3.3 will become accessible by launching a new shell instance using the Software Collection
scl
command.scl enable python33 bash
The
-V
parameter will confirm the available Python version.python -V
Additional Python libraries and tools, such as pip, can now be installed.
easy_install pip
It is important to remember to use the appropriate path to the new Python binary in your code.
#!/opt/rh/python33/root/usr/bin/python
Comments
Post a Comment