Python (1): Introduction to Python and environment configuration

More and more programmers know the importance of Python and want to get this new skill. But if we want to learn Python quickly, we need to know the history of Python. For example: In what year was Python created? What can Python do?..

Python发展史

The founder of Python is Guido van Rossum. During the Christmas period in 1989, Guido Van Rossum (Chinese name: Uncle Turtle) decided to develop a new script interpreter as a successor to the ABC language in order to pass the time in Amsterdam. He joined Google from 2005 to 2012, and joined Dropbox in 2013 until now. He still holds the core direction of Python development and is known as a benevolent dictator.

Insert picture description here
Python itself is also developed from many other languages, including ABC, Modula-3, C, C++, Algol-68, SmallTalk, Unix shell, and other scripting languages. Like the Perl language, the Python source code also follows the GPL (GNU General Public License) agreement.

Python is now maintained by a core development team, and Guido van Rossum still plays a vital role in guiding its progress. Python 2.7 is determined to be the last Python 2.x version. In addition to supporting Python 2.x syntax, it also supports part of Python 3.1 syntax.

Python地位

According to the current situation, Python ranks third in the TIORB ranking. Python advocates beauty, clarity, and simplicity, and is an excellent and widely used language.

The overall trend of Python is on the rise, reflecting the increasing use of Python and the gradual recognition in the industry!

Python的主要应用领域

  • Cloud Computing: The most popular language of cloud computing, typical application OpenStack
  • WEB development: Many excellent WEB frameworks, many large-scale websites are developed in Python, Youtube, Dropbox, Douban, typical WEB frameworks include Django scientific computing
  • Artificial intelligence: typical libraries NumPy, SciPy, Matplotlib, Enthought librarys, pandas
  • System operation and maintenance: essential language for operation and maintenance personnel
  • Crawler: Simulate human page access through code, and obtain information in batches
  • Finance: Quantitative trading, financial analysis, in the field of financial engineering, Python is not only used, but also used the most, and its importance is increasing year by year. Reason: As a dynamic language, Python has a clear and simple language structure, rich libraries, mature and stable, scientific computing and statistical analysis are very powerful, production efficiency is much higher than C, C++, java, especially good at strategy backtesting
  • Graphical GUI: PyQT, WxPython, TkInter

Python在哪些公司被使用

  • Google: Google App Engine, code.google.com, Google earth, Google crawler,

    Projects such as Google Ads are heavily developed using Python

  • CIA: The CIA website is developed in Python

  • NASA: NASA uses Python extensively for data analysis and calculations

  • YouTube: The world's largest video site YouTube is developed in Python

  • Dropbox: The largest online cloud storage website in the United States, all implemented in Python, the website handles the upload and download of 1 billion files every day

  • Instagram: The largest picture sharing social networking site in the United States. More than 30 million photos are shared every day, all developed with python

  • Facebook: A large number of basic libraries are implemented through Python

  • Redhat: The yum package management tool in the most popular Linux distribution in the world is developed with python

  • Douban: Almost all of the company's business is developed through Python

  • Zhihu: The largest Q&A community in China, developed through Python (Quora abroad)

  • Dr. Chun Yu: Well-known online medical websites in China are developed with Python

In addition to the above, companies such as Sohu, Jinshan, Tencent, Shanda, Netease, Baidu, Ali, Taobao, Tudou, Sina, and Guok are all using Python to complete various tasks.

Python是什么编程语言

Programming languages ​​are mainly classified from the following perspectives: compiled and interpreted, static and dynamic languages, strongly typed definition languages ​​and weakly typed definition languages. What does each category mean? Let's take a look together.

1.3.1 Compiled and interpreted
compilers compile every statement of the source program into machine language and save it into a binary file, so that the computer can directly run the program in machine language at runtime, and the speed is very fast; and the interpretation When the program is executed, the program is interpreted one by one into machine language for the computer to execute, so the running speed is not as fast as the compiled program. This is because the computer cannot directly recognize and execute the sentences we write, it can only recognize machine language (in binary form).

1.3.2 Dynamic language and static language
Generally speaking, dynamic language and static language refer to dynamic type language and static type language.

  • Dynamically typed language: Dynamically typed language refers to a language that does data type checking during runtime. That is to say, when programming in a dynamically typed language, you never need to assign data types to any variables. This language will be your first choice. When assigning to a variable once, the data type is recorded internally. Python and Ruby are typical dynamically typed languages, and various other scripting languages ​​such as VBScript are also dynamically typed languages.
  • Statically typed language: Statically typed language is just the opposite of dynamically typed language. Its data type is checked during compilation, which means that the data types of all variables must be declared when writing a program. C/C++ is a typical representative of statically typed languages. , Other statically typed languages ​​include C#, JAVA, etc.

1.3.3 Strongly typed definition language and weakly typed definition language

  • (1) Strongly typed definition language: a language that enforces data type definition. In other words, once a variable is assigned a certain data type, if it is not coerced, it will always be of this data type.

For example: if you define an integer variable a, it is impossible for the program to treat a as a string type. A strongly typed language is a type-safe language.

  • (2) Weak type definition language: a language in which data types can be ignored. It is contrary to a strongly typed definition language, a variable can be assigned values ​​of different data types. Strongly typed languages ​​may be slightly inferior to weakly typed languages ​​in terms of speed, but the rigor brought by strongly typed languages ​​can effectively avoid

Avoid many mistakes. In addition, there is absolutely no connection between "is this language a dynamic language" and "is this language type-safe"! For example: Python is a dynamic language, a strongly-typed language (type-safe language); VBScript is a dynamic language, a weakly-typed language (type-unsafe language); JAVA is a static language, a strongly-typed language (type-safe language) language).

Through the above introduction, we can conclude: Python is a dynamically interpreted weakly typed definition language. After reading so much content, I feel so powerful and I can’t wait to try it out. I have to say, I still need to wait a moment, what are you waiting for? Wait for a martial arts cheat, our cheat is a software that can be used to learn Python.

环境配置

Python has been ported to many platforms (modified so that it can work on different platforms). You need to download the binary code for the platform you are using, and then install Python.

If the binary code of your platform is not available, you need to manually compile the source code using a C compiler. The compiled source code has more functional options and provides more flexibility for Python installation.

注:确保安装包已经安完毕(找不到安装包的直接阅读到本文章最底部)

Set environment variables on Unix/Linux

In the csh shell: type

setenv PATH "$PATH:/usr/local/bin/python"

 

In bash shell (Linux): type

export PATH="$PATH:/usr/local/bin/python" 

 

In sh or ksh shell: type

PATH="$PATH:/usr/local/bin/python" 

 Note: /usr/local/bin/python is the installation directory of Python.
 

Set environment variables in Windows

Add the Python directory in the environment variable: in the command prompt box (cmd): input

path=%path%;C:\Python 

Note: C:\Python is the installation directory of Python.

Insert picture description here
 

运行Python

  • 1. Interactive interpreter

    You can enter Python through the command line window and start writing Python code in the interactive interpreter. You can
    do Python encoding work on Unix, DOS, or any other system that provides a command line or shell.

    cpp $ python # Unix/Linux
    
    或者
    
    C:>python # Windows/DOS ```
    
  • 2. Command line script

    You can execute Python scripts on the command line by introducing an interpreter in your application, as shown below:

    cpp $ python script.py # Unix/Linux
    
    或者
    
    C:>python script.py # Windows/DOS ```
    
    

3. Integrated Development Environment (IDE: Integrated Development Environment): PyCharm

Insert picture description here
 

Python installation problem answers, as shown below

 

Guess you like

Origin blog.csdn.net/qq_40453947/article/details/112601965