Check the version
Python runs on many operating systems such as MS-Windows, Mac OS, Mac OS X, Linux, FreeBSD, OpenBSD, Solaris, AIX, and many varieties of free UNIX like systems. The latest version of CentOS, Fedora, RHEL and Ubuntu come with Python 2.7 out of the box.
To see which version of Python you have install, open a command terminal and run:
Sample outputs:
Or type:
Sample outputs:
That is the version of python you have got and you can start building Python applications .
Use package manager
The easiest way to install the Python is to use package manger such as apt-get, yum, and so on.
Debian / Ubuntu Linux user
Use the following command to search for available versions of Python2.x under Debian and Ubuntu Linux:
Type the following command to install python version 2.x:
Type the following command to install python version 3.x:
Sample outputs:
Red Hat/ RHEL / CentOS Linux user
Type the following command:
OR
From the Internet
Your can also download the version you want from the Internet.
Type the following command to download it:
Type the folowing command to extract the file and go into the directory:
Read the README file to figure out how to install, or do the following with no guarantees:
For Python 3.5 use the following download address: http://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
For other versions and the most up to date download links: http://www.python.org/getit/
Others
Setuptools & Pip
The two most crucial third-party Python packages are setuptools and pip.
Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default.
To see if pip is installed, open a command prompt and run:
To install pip, follow the official pip installation guide - this will automatically install the latest version of setuptools.
Environment variable
Also add the path of new python in ‘PATH’ environment variable.
Type the following command if new python is in /root/python-2.7.4
: