Centos (серверная linux)
Добавлено: Ср, 22 февраля 2017, 08:10:12
Установка питона 3
http://idroot.net/tutorials/how-to-install-python-3-on-centos-7/
http://idroot.net/tutorials/how-to-install-python-3-on-centos-7/
- Спойлер
- Home » Linux » Centos » How To Install Python 3 on CentOS 7
How To Install Python 3 on CentOS 7
r00t January 31, 2016
Install Python 3 on CentOS 7
In this tutorial we will show you how to install and configuration Python 3 on CentOS 7 server. As of the latest CentOS 7, the default Python version still remains python 2.7, and python3 is not available in base repositories. If you need to use python3 as part of Python application dependency, there are several ways to install python3 on CentOS.
This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Python on a CentOS 7 server.
Install Python 3 on CentOS 7
Step 1. First let’s start by ensuring your system is up-to-date.
yum -y update
yum groupinstall "Development tools"
1
2
yum -y update
yum groupinstall "Development tools"
Step 2. Installing Python.
Method One: Build and Install Python3 from the Source
First thing to do is to go to Python’s download page and download the latest stable version of Python, At the moment of writing this article it is version 3.5.1:
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
1
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
Extract source archive and build:
tar xzf Python-3.5.1.tgz
cd Python-3.5.1
1
2
tar xzf Python-3.5.1.tgz
cd Python-3.5.1
Next, we are going to configure the installation directory on /usr/local, We can change the path:
./configure --prefix=/usr/local
1
./configure --prefix=/usr/local
Building and installing Python through below make altinstall command , this command will replace the python , which is using by the server:
make altinstall
1
make altinstall
You now should be all set to use your newly compiled python version:
# python3.5 –V
Python 3.5.1
1
2
# python3.5 –V
Python 3.5.1
Method Two: Install Python3 from EPEL Repository
First, you need to enable EPEL repository on your system:
yum install epel-release
1
yum install epel-release
Then install python 3.4 and its libraries using yum:
yum install python34
1
yum install python34
Method Three: Install Python3 from Software Collections (SCL)
The first step is to install the utilities needed to manage collections:
yum -y install scl-utils
1
yum -y install scl-utils
Once you enable the SCL repository, go ahead and install python3 as follows:
yum -y install python33
1
yum -y install python33
Python 3.3 will become accessible by launching a new shell instance using the Software Collection scl command:
scl enable python33 bash
1
scl enable python33 bash
Additional Python libraries and tools, such as pip, can now be installed:
easy_install pip
1
easy_install pip
Congratulation’s! You have successfully installed Python. Thanks for using this tutorial for installing Python 3 on CentOS 7 system. For additional help or useful information, we recommend you to check the official Python web site.