Python introduction and environment installation

1. Introduction

Python is an interpreted, object-oriented, high-level programming language with dynamic data types.

The Python source code also follows the GPL (GNU General Public License) agreement.

Python is cross-platform.

One difference from most other languages ​​(such as C) is that the boundaries of a module are determined entirely by the position of the first character of each line on the line (whereas C is defined by a pair of curly braces {} . Sets the boundaries of the module, and has nothing to do with the position of the characters). Makes bad programming practices (such as the next line of an if statement not indented to the right) fail to compile. One of the most important ones is Python's indentation rules.

Version 3.0 of Python, often referred to as Python 3000, or Py3k for short. Python 3.0 was not designed with backward compatibility in mind.

2. Download

Python's latest source code, binary documentation, news, etc. can be viewed on Python's official website:

Python official website: https://www.python.org/

You can download documentation for Python at the link below, you can download documentation in HTML, PDF and PostScript formats.

Python documentation download address: https://www.python.org/doc/

3. Installation

Since my computer is a Mac, I only introduce the installation on the Mac here. For other systems Linux and Windows, please search online by yourself.

If you are using a Mac, the system is OS X 10.8~10.10, then the Python version that comes with the system is 2.7.

命令行输入:python
Python 2.7.10 (default, Feb  7 2017, 00:08:15) 

We download the latest version. https://www.python.org/downloads/mac-osx/

The current latest version is 3.6.5. There are 2 installation packages. Applicable to different Mac OS.

macOS 64-bit/32-bit installer Mac OS X for Mac OS X 10.6 and later bf319337bc68b52fc7d227dca5b6f2f6 28093627 SIG
macOS 64-bit installer Mac OS X for OS X 10.9 and later 37d891988b6aeedd7f03a70171a8420d 26987706 SIG

After the installation is complete, start the command line.

命令行输入:python3
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31) 

 Note: After Python3.x, the command is: python3

4. Python interpreter

When we write Python code, what we get is a text file with the extension .pythat . To run the code, the Python interpreter is required to execute the .pyfile.

CPython

When we downloaded and installed Python 3.x from the official Python website , we directly obtained an official version of the interpreter: CPython. This interpreter is developed in C language, so it is called CPython. Running from the command line pythonstarts the CPython interpreter.

CPython is the most widely used Python interpreter. All code for the tutorial is also executed under CPython.

PyPy

PyPy is another Python interpreter whose goal is execution speed. PyPy uses JIT technology to dynamically compile Python code (note that it is not interpreted), so it can significantly improve the execution speed of Python code.

Most Python code can be run under PyPy, but there are some differences between PyPy and CPython, which leads to the same Python code execution under the two interpreters may have different results. If your code is going to be executed under PyPy, you need to understand the differences between PyPy and CPython .

Jython

Jython is a Python interpreter running on the Java platform, which can directly compile Python code into Java bytecode for execution.

IronPython

IronPython is similar to Jython, except that IronPython is a Python interpreter running on Microsoft's .Net platform, which can directly compile Python code into .Net bytecode.

 

Refer to 
Liao Xuefeng's official website https://www.liaoxuefeng.com

http://www.runoob.com

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325256286&siteId=291194637