Learn Python-Lesson 1: Basic Introduction, learn python-Lesson 1
Python past and present
The founder of python is Guido van rosum ). During the Christmas period of 1989, Guido fansoum was determined to develop a new script interpreter to pass the time in Amsterdam as an inheritance of the ABC language.
Why Python instead of other languages?C, Python, Java, and C #
C language: the code is compiled to obtain the machine code. The machine code is directly executed on the processor, and each command controls CPU work.
Other languages: the code is compiled to get the bytecode. The virtual machine executes the bytecode and converts it to the machine code, and then runs it on the processor.
Python and C Python are developed by C.
For usage: Python class libraries are complete and simple to use. To implement the same function, Python 10 lines of code can solve the problem, and C may need 100 lines or more.
For speed: Compared with C, Python runs slowly.
Python, Java, and C #
For use: the original Linux Python is not available in other languages; The above languages have very rich class library support
For speed: Python speedPossibleSlightly inferior
Therefore, there is no essential difference between Python and other languages. The other difference is that Python is good at a certain field, rich talents, and preemptible.
Python type
- Cpython
Python official version, which is implemented in C language and most widely used. CPython converts the source file (py file) into a bytecode file (pyc file) and runs on a Python virtual machine.
- Jyhton
For Java Implementation of Python, Jython dynamically compiles Python code into Java bytecode and runs it on JVM.
- IronPython
IronPython compiles Python code into C # bytecode and runs it on the CLR. (Similar to Jython)
- PyPy (special)
Python implements Python, and then encodes Python bytecode into machine code.
- RubyPython, Brython...
Python Environment
Install Python
Windows:
Install Python
Configure the python Environment
Linux:
Linux yum dependency comes with Python. To prevent errors, the update here is actually to install another Python
12345678910111213141516171819 |
View the default Python version python - V 1 Install gcc for compiling Python source code yum install gcc 2 Download the source code package, https: / / www.python.org / ftp / python / 3 , Decompress and enter the source code file 4 , Compilation and Installation . / configure make all make install 5 View version / usr / local / bin / python2. 7 - V 6 Modify the default Python version mv / usr / bin / python / usr / bin / python2. 6 ln - s / usr / local / bin / python2. 7 / usr / bin / python 7 To prevent yum execution exceptions, modify the Python version used by yum vi / usr / bin / yum Set the header #! /Usr/bin/python #! /Usr/bin/python2.6 |