Python Learning (a)--the first knowledge of Python

Source: Internet
Author: User

I. Introduction of Python

Python (United Kingdom pronunciation:/?pa?θ?n/American pronunciation:/?pa?θɑ?n/), is an object-oriented, interpreted computer programming language, by Guido van Rossum was invented in 1989 and the first public release was released in 1991.

Python is purely free software, and the source code and interpreter CPython follow the GPL (GNU general public License) agreement. Python syntax is simple and clear, and one of the features is to force whitespace (white space) to be indented as a statement. Python has a rich and powerful library. It is often nicknamed the glue language and is able to easily connect a variety of modules made in other languages, especially in C + +. A common application scenario is to use Python to quickly build a prototype of a program (sometimes even the final interface of the program) and then rewrite it in a more appropriate language, such as a graphics rendering module in a 3D game, with a particularly high performance requirement, and can be rewritten in C + + with a specially requested part. It is then encapsulated as an extension class library that Python can call. It is important to note that you may need to consider platform issues when you use the Extended class library, and some may not provide cross-platform implementations. (The above content from Baidu Encyclopedia: Python) two, Python type
    • Cpython
      The official version of Python, implemented using the C language, is the most widely used, and the CPython implementation converts the source file (py file) into a bytecode file (PYc file) and then runs on the Python virtual machine.
    • Jyhton
      Python Java implementation, Jython will dynamically compile Python code into Java bytecode, and then run on the JVM.
    • IronPython
      In Python's C # implementation, IronPython compiles Python code into C # bytecode and then runs on the CLR. (similar to Jython)
    • PyPy (Special)
      Python implements Python, which compiles Python bytecode bytecode into machine code.
    • Rubypython, Brython ...

In addition to PyPy, the corresponding relationship and execution flow of Python are as follows:

PyPy, the Python bytecode is further processed on the basis of Python, which improves execution speed!

(The above content is excerpted from Wu Yuzi Teacher's blog)

Third, the Python environment construction

1. Windows environment:

1) Download the Python installation package (official website: https://www.python.org/)

  

You can choose Python2 Latest version 2.7.11 or Python3 latest version 3.5.1

  

Choose Python's Windows version installation package based on the system version (32-bit or 64-bit)

  

2) Start the installation and select the Universal installation (Customize installation). another: Before the Add Python 3.5 to path tick, after the installation is complete, will automatically add Python to the Windows environment variable, do not set itself.

  

Next Default Select All

  

Tick Install for all users (installs for everyone), Customize insatll location entry set the native Python installation, click the Install button

  

Installation Complete

  

3) After the installation is verified, open the Windows command Console, enter Python, and return to the following screen, indicating success

  

If the validation fails, set an error for the environment variable, but "My Computer" right-click the system variable->path, environment variable, advanced system settings, properties----see if the Python environment variable is set correctly

2. Installation of Linux environment (Cent OS 6.5)

1) Download the Python 2.7 installation package,

Right-click on the desktop, click Open in Terminal, turn on the console

  

Switch to the directory where you want to store the downloaded file, enter wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz, and start the download

  

2) Download complete, Unzip tar zxvf python-2.7.11.tgz (tar command specific parameters and other usage see http://www.2cto.com/os/201308/233614.html), CD Python-2.7.11 into the Unzip directory

  

3) Installation

1./configure

  

2 Make all

  

3 Make Install

  

The result is an error, what reason? "Cannot create regular file '/usr/local/bin/python2.7 ':P ermission denied" cannot be created because:

Current user does not have permission to operate on/usr/local/bin/(create, update, etc.)

WORKAROUND: Switch to the root (admin) user, go to the Python-2.7.11 directory, and re-execute the Make install command

  

4 Make clean (clears the ". O" file) from the last make command and the executable file)

  

5 make Distclean (similar to do clean, but also delete all configure generated files, including makefile)

Note: You can actually make Distclean directly without performing a 4th step

4)/usr/local/bin/python2.7-v (view version information)

  

View System Python version/usr/bin/python-v

  

5) Modify the original Python connection, and use the soft link to speak the default Python version into 2.7.11

1. mv/usr/bin/python/usr/bin/python2.6.6

2. Ln-s/usr/local/bin/python2.7/usr/bin/python

(Linux environment Installation python reference Eva blog)

Python Learning (a)--the first knowledge of Python

Related Article

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.