This document uses Python 2.7.13 as an example to demonstrate how to install and configure Python in Windows and Linux.
Double click the Python installer package, and install Python as instructed.
(1) Once Python is installed, restart your computer as instructed.
(2) Right-click on the "Computer" or "My Computer" desktop icon, and select Properties > Advanced system settings > Environment Variables. In System variables, locate Path, or click New to create a variable named as such.
(3) Click Edit > Edit Text, and add
;C:\Python27 (replace it with your own Python installation path) to the end of the “Path”.
(4) Click OK.
Click Start (or shortcut: Win+R) > Run (enter
cmd) > OK (or press Enter), enter the Python command in the pop-up window, and press Enter. If Python version information appears, Python 2.7 has been installed successfully.
Linux’s yum comes with Python. So check the default Python version first.
If it comes with Python 2.7 or above, ignore the following steps. Otherwise (for example, if it comes with Python 2.6.6), enter the following command:
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz tar xf Python-2.7.12.tar.xz
cd Python-2.7.12 //Enter the directory ./configure -prefix=/usr/local make && make install //Install make clean make distclean
mv /usr/bin/python /usr/bin/python2.6.6 ln -s /usr/local/bin/python2.7 /usr/bin/python
If the information appears as shown below, Python 2.7 has been installed successfully.
If permission problems occur, try to add
sudoto the beginning of your command.