Here we use Python 2.7 as an example to demonstrate the installation and configuration of Python in Windows and Linux.
Double click the Python installer package, and install Python as instructed.
After installation, right click Computer, click Properties -> Advanced system settings -> Environment Variables -> System variables (S) to find "Path" (if it does not exist, create one). Add the Python installation path
;C:\Python27 (change it to your installation path) to the end of "Variable value", and click OK to save.
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.
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 following message appears, Python 2.7 is installed and configured successfully:
If permission-related errors occur, try to add sudo before command.