How to install Python server on CENTOS7
To install Python Server on CentOS7
Python is a widely useful high-level programing language for a wide variety of educational, enterprise, and scientific purposes &ndash from web development to desktop applications to machine learning and everything in between.
Currently, there are two major Python versions in use 2 and 3, but the version 2 is rapidly losing grounds to version 3 as the former is no longer under active development.
Although we can install the core packages and their dependencies using yum and aptitude (or apt-get), in this tutorial, you will learn how to perform the installation from source instead.
This way you’ ll have the latest stable release of the language (3.6) and to provide a distribution-agnostic installation method.
Installing Python Server
Prior to installing Python in CentOS 7, let’ s make sure our system has all the necessary development dependencies, so run the following commands to check that.
[root@linuxhelp ~]# yum -y groupinstall development
[root@linuxhelp ~]# yum -y install zlib-devel
Now, in order to install Python 3.6, you need to download the latest stable package with the wget command as follows.
root@linuxhelp ~]# wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
--2018-01-31 06:13:24-- https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
Resolving www.python.org (www.python.org)... 151.101.0.223, 151.101.64.223, 151.101.128.223, ...
Connecting to www.python.org (www.python.org)|151.101.0.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16974296 (16M) [application/octet-stream]
Saving to: ‘ Python-3.6.3.tar.xz’
100%[====================================================================> ] 16,974,296 1.04MB/s in 30s
2018-01-31 06:13:55 (550 KB/s) - ‘ Python-3.6.3.tar.xz’ saved [16974296/16974296]
And then extract the tar file by making use of the following command.
[root@linuxhelp ~]# tar xJf Python-3.6.3.tar.xz
[root@linuxhelp ~]# cd Python-3.6.3
After this, you need to configure the file by making use of the following command.
[root@linuxhelp Python-3.6.3]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
.
.
Complete
Now you need to install Python, and we can install through the make and make install commands as follows.
[root@linuxhelp ~]# make . . Complete [root@linuxhelp ~]# make install . . # cleanup[3] wiping encodings.latin_1 # cleanup[3] wiping sys # cleanup[3] wiping builtins
Congratulations! Python 3.6 is now installed on your system.
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
Perhaps another user on the computer wanted to learn programming and installed it; you’ll have to figure out who’s been using the machine and might have installed it.
If someone installed it deliberately, you can remove it without hurting anything. On Windows, use the Add/Remove Programs icon in the Control Panel.
cd /usr/local/lib/python3.5/site-packages
sudo vim dist-packages.pth
(Press i to go into insert mode inside Vim)
../dist-packages
:x (and Press Enter/Return)