Probably the most detailed Python installation tutorial on the whole network (windows+iOS)

Python can do too many interesting things. It can not only do artificial intelligence and data analysis, but also crawlers, web development, and automated operation and maintenance.

As Python brings more convenience to our work and life, many people start to learn Python and pay attention to the development prospects of Python, the improvement of salary and professionalism.

So I had a bold idea to write a series of Python-related articles in more detail. The first is to learn the basics of Python in 20 days, which covers the basic knowledge points necessary for Python. I hope you can use your spare time to master Python development skills. Easy career transition.insert image description here

What is a programming language?

Python code example:

python
复制代码
print("hello world")

This code, which you will learn later in the course, allows the computer to print something like "hello world" on the screen.

It can be seen that this code is composed of English words and punctuation marks. In fact, programming is like writing a text, but some special format regulations must be followed when writing.

But computers process operations based on binary 0s and 1s, so today's world is called the digital age. This combination of 0 and 1 instructions is also called machine language. Machine language is an instruction that computers can directly process. In other words, computers do not understand the English words and punctuation marks we write when programming.

So how does the code we program and write control the operation of the computer?

Just like when we talk to foreigners, we need to translate the content into English. If our code wants to run, it must go through translation processing to translate the Python language code into machine language. This process is called compilation, and the software used to process code compilation is called a compiler.

A programming language is a formal language used to define computer programs. We write program code through programming language, and then send instructions to the computer through language processing program execution, so that the computer can complete the corresponding work.

Simply put, a programming language is a language for communicating between humans and computers. insert image description here

How do computers process programs?

According to the principle of Von Neumann's stored program, the computer's workflow is roughly as follows:

The user opens the program, and the program starts to execute; the operating system sends the program content and related data into the memory of the computer; the CPU reads instructions from the memory according to the program content; the CPU analyzes and processes the instructions, and prepares for the next instruction; An instruction is analyzed and processed, and the operation is repeated until all instructions in the program are executed, and finally the calculated result is placed in the memory address specified by the instruction.insert image description here

Introduction to Python

Python is a programming language invented by Dutchman Guido von Rossum (Guido von Rossum, later called Guido).

History of Python
  1. Christmas 1989: Guido started writing a compiler for the Python language.
  2. February 1991: The first Python interpreter was born, which was implemented in C language and could call library functions in C language.
  3. January 1994: Python 1.0 is officially released.
  4. October 2000: Python 2.0 was released, the entire development process of Python became more transparent, and the ecosystem began to slowly form.
  5. December 2008: Python 3.0 was released, introducing many new features of modern programming languages, but not fully compatible with previous Python code.

Note : The version number of most software is generally divided into three sections, in the shape of ABC, where A represents a major version number, and A will only be added when the software is rewritten and upgraded as a whole or when there is a change that is not backward compatible; B represents a function update , add B when there is a new function; C means a small change (for example: a bug is fixed), and add C as long as there is a modification.

Advantages of Python

There are many advantages of Python, and I will simply list a few for you.

  1. Simple and clear, Python is easier to learn than many other languages.
  2. Open source, with a strong community and ecosystem.
  3. It can run on various systems such as Windows, macOS, and Linux.
Applications of Python

At present, Python is useful in the fields of web server application development , cloud infrastructure development, network data collection (crawler), data analysis , quantitative trading, machine learning , deep learning , automated testing , automated operation and maintenance , etc.

Install the Python environment

To start your Python programming journey, you must first install a Python environment on your computer. Simply put, you need to install a tool to run Python programs, usually called a Python interpreter. We strongly recommend that you install a Python 3 environment, which is obviously the better choice at the moment.

Windows environment

You can find the download link and download the installer for Python 3 at the official Python website . [Biography (img-ChwsuWQo-1616552580590)(res/download-python.png)]For Windows OS, the "executable installer" can be downloaded. It should be noted that if you install Python 3 in the Windows 7 environment, you need to install the Service Pack 1 patch package first. You can enter the command in the "Run" of Windows, and you can see whether your system is installed in the pop-up window winver. The patch pack. If you do not have the patch package, you must first install the patch package automatically through "Windows Update" or a tool like "CCleaner". After the installation is complete, you usually need to restart your Windows system before starting to install the Python environment. insert image description hereDouble-click to run the installer you just downloaded, and the installation wizard for the Python environment will open. When executing the installation wizard, remember to check the "Add Python 3.x to PATH" option, this option will help us add the Python interpreter to the PATH environment variable (it doesn't matter if you don't understand, just do it), the specific steps As shown below. insert image description hereinsert image description here insert image description here insert image description hereAfter the installation is complete, you can open the Windows "Command Line Prompt" tool and enter python --versionor python -Vto check whether the installation is successful. The command line prompt can be opened by typing in "Run" cmdor found in the accessories of the "Start Menu". If you see the version number corresponding to the Python interpreter (for example: Python 3.7.8), it means that your installation has been successful, as shown in the figure below.insert image description here

Note : If the installation process shows that the installation fails or an error is reported when executing the above command, it is likely that the problem is caused by the lack of some dynamic link library files in your Windows system. If the system displays that the api-ms-win-crt*.dll file is missing, you can download the Visual C++ Redistributable for Visual Studio 2015 file from Microsoft's official website to repair it. For 64-bit systems, you need to download the installation file marked with x64. If some dynamic link library files are missing after updating Windows DirectX when installing the game, you can download a DirectX repair tool to repair it.

macOS environment

macOS comes with Python 2, but we need to install and use Python 3. You can find the "macOS installer" suitable for macOS through the download link provided by the Python official website to install Python 3. Basically, you don't need to check anything during the installation process, just click "Next". After the installation is complete, you can enter the command in the "Terminal" tool of macOS python3to invoke the Python 3 interpreter, because if you enter it directly python, the Python 2 interpreter will be invoked.

Use of pip

After installing Python, you can see insert image description herethat Lib is the standard library of Python by viewing the directory, which contains various library files used in development, but these are far from enough in subsequent development, we still need more first Three-party extension library. Then you need the help of pip.

pip is a modern, general-purpose Python package management tool. Provides the functions of searching, downloading, installing, and uninstalling Python packages, which is convenient for us to manage Python resource packages.

Install

When installing Python, it will automatically download and install pip.

configuration

In the windows command line, enter pip -Vto view the version of pip. insert image description hereIf you run it on the command line, pip -Vthe following prompt appears: insert image description hereIt may be because the option was not checked during the python installation process Add Python 3.7 to PATH, and the environment variable of pip needs to be manually configured.

The manual configuration is as follows:

  • Right-click 此电脑–> 环境变量–> Find and double-click Path–> Click New in the pop-up window –> Find the pip installation directory and add the path to it.insert image description here
  • The newly added path here is the directory where the executable file is located C:\Users\你的用户名\AppData\Local\Programs\Python\Python37\Scriptsafter Python is installed .pip.exeinsert image description here

Manage Python packages with pip

  • pip install <包名>installs the specified package
  • pip uninstall <包名>removes the specified package
  • pip list shows installed packages
  • pip freeze displays installed packages and displays them in the specified format
  • pip install -r required.txt installs the installation packages listed in the required.txt file

Modify pip download source

Running the pip install command will download the specified python package from the website, which is https://files.pythonhosted.org/downloaded from the website by default. This is a foreign website. When the network situation is not good, the download may fail. We can modify the source of pip's current software through commands. Format:

css
复制代码
pip install 包名 -i 国内源地址

Example: pip install flask -i https://pypi.mirrors.ustc.edu.cn/simple/Download flask (a third-party web framework based on python) from the server of University of Science and Technology of China (ustc)

List of commonly used pip download sources in China:

Getting to Know Python Summary

At this point, everyone has a basic understanding of the Python language and knows that it can do many things, so it is worth learning.

To use Python for development, you first need to install the Python environment on your own computer. Above we have introduced the installation methods of the Python 3 environment in both macOS and Windows environments. study.

If you are interested in Python and want to get a higher salary by learning Python, then the following set of Python learning materials must be useful to you!

Materials include: Python installation package + activation code, Python web development, Python crawler, Python data analysis, artificial intelligence, machine learning and other learning tutorials. Even beginners with 0 basics can understand and understand. Follow the tutorial and take you to learn Python systematically from zero basics!

1. Learning routes in all directions of Python

The route of all directions in Python is to organize the commonly used technical points of Python to form a summary of knowledge points in various fields. Its usefulness lies in that you can find corresponding learning resources according to the above knowledge points to ensure that you learn more comprehensively.
insert image description here
2. Python learning software

If a worker wants to do a good job, he must first sharpen his tools. The commonly used development software for learning Python is here!
insert image description here
3. Python introductory learning video

There are also many learning videos suitable for getting started with 0 basics. With these videos, you can easily get started with Python~insert image description here

4. Python exercises

After each video lesson, there are corresponding practice questions, you can test the learning results haha!
insert image description here

Five, Python actual combat case

Optical theory is useless. You have to learn to type codes along with it, and then you can apply what you have learned in practice. At this time, you can learn from some practical cases. This information is also included~insert image description here

6. Python interview materials

After we have learned Python, we can go out and find a job with the skills! The following interview questions are all from first-line Internet companies such as Alibaba, Tencent, and Byte, and some Alibaba bosses have given authoritative answers. After reading this set of interview materials, I believe everyone can find a satisfactory job.
insert image description here
insert image description here
7. Information collection

The full set of learning materials for the above-mentioned full version of Python has been uploaded to the CSDN official website. Those who need it can scan the QR code of the CSDN official certification below on WeChat to receive it for free.

Guess you like

Origin blog.csdn.net/Python966/article/details/132084748