Before learning a language, let's understand why we should learn it.
Python is a scripting language, simple language, compatible with the various versions of the system, learning the language will be a future operation and maintenance of the daily work to provide great convenience.
1.1 Linux under Python installation
First download the required Python version from the official website, unzip and install it directly,
[Email protected]/]# TAR-ZXF python-2.7.11.tgz
[Email protected]/]# CD Python-2.7.11
[[email protected]/]#./configure && make && make install
Then we can see in the installation directory that Python 2.7. Version 11 is already installed
[Email protected] usr]#/usr/local/bin/python
Python 2.7.11 (Default, Jan 2 2017, 12:16:39)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>> exit ()
But our system comes with the version of Python 2.6.6, how do we replace the compiled Python 2.7.11?
[[email protected] usr]# python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>>
>>> exit ()
Let's go to the directory where the system Python is located, back up the boot files, and then delete
[Email protected] usr]# CD.
[Email protected]/]# cp/usr/bin/python/usr/bin/python.bak.2017
[Email protected]/]# Rm/usr/bin/python
Rm:remove regular file '/usr/bin/python '? Y
Then we put the compiled Python 2.7.11 version of the boot file into a soft connection to the current directory, and then we look at the Python version, it becomes our compiled version.
[Email protected]/]# ln-s/usr/local/bin/python2.7/usr/bin/python
[[email protected]/]# python
Python 2.7.11 (Default, Jan 2 2017, 12:16:39)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>>
>>> exit ()
1.2 Installation under Windows python
Download the installation package from the official website to add environment variables.
1 Python Introduction and installation