1 Python Introduction and installation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.