For those who are new to Python, whether you are interested in web scraping or AI development, many say that the Python language is simple. Therefore, learning more is always beneficial. Below is a record of the installation of Python and a series of related tasks from the perspective of a complete beginner, including the problems encountered, so that even those who know nothing can get started with the installation and complete their first “Hello World” code.
[Python Installation] Installation package is available at the end (no activation required)
Currently, there are two versions of Python: 2.x and 3.x. These two versions are not compatible. As version 3.x becomes more popular, our tutorial will be based on the latest Python 3.9 version.
Visit the official Python download page
http://www.python.org/download/
There are many versions available; we choose the latest version 3.9.0.
After the download is complete, click to run, and the installation interface will appear. Remember to check the box.
If this appears, the installation was successful.
2. Running Python After successful installation, open the command prompt window (win+R, type cmd and press enter), type python, and two situations may occur:
Situation 1:
This indicates that Python was installed successfully. If you see the prompt >>>, it means you are in the Python interactive environment, where you can enter any Python code and get immediate execution results. Now, type exit() and press enter to exit the Python interactive environment (or you can simply close the command line window).
Situation 2: An error occurs:
I will not demonstrate this here because my installation was successful. However, I will show an example using an incorrect command “pythonn” instead of “python” to trigger an error message.
3. Configuring Environment Variables
This is because Windows looks for python.exe based on the path set in the Path environment variable. If it cannot find it, an error will occur. If you forgot to check the box “Add Python 3.9 to PATH” during installation, you will need to manually add the path where python.exe is located to the Path.
If you find that you forgot to check the box or do not know how to set the PATH, you can reinstall and remember to check “Add Python 3.9 to PATH” to resolve the issue. (Step 2: The error message usually indicates that the environment variable is not configured.)
4. Steps: Right-click on My Computer -> Select Properties -> Select Advanced System Settings -> Select Environment Variables at the bottom right
The environment variables mainly include user variables and system variables. The environment variable that needs to be set is in these two variables.User variables allow you to use downloaded programs in the cmd command by writing the absolute path of the program into the user variables.
5. Test OutputPress win+R, type cmd and press enter
Type python and press enter to enter the Python development environment
It is important to note that when calling functions (like print), parentheses are required; otherwise, an error will be prompted.
To output text directly after print, you need to enclose the text in double or single quotes. You will find that print can output not only text but also various numbers, calculation results, comparison results, etc. Try printing some other things yourself to see which succeed and which fail, and if you’re interested, guess the reasons for the failures.
Actually, in the Python command line, print can be omitted; it will default to outputting the result of each command. Just like this:
[ Installing Development Tools ]
Install the PyCharm tool, which can be downloaded online. There are many resources available, including a portable version that can be used after extraction. I am currently demonstrating the installation of the PyCharm development tool.
The first time you open PyCharm, this will be displayed.
By selecting this, a venv folder will be created, and a new virtual environment will be created by default when starting a new project.
No activation is required for the installation package that has already been prepared for you.
-
Finally, we have prepared some programming learning materials for efficient learning.
-
1. Learning Path for All Directions of Python
-
A compilation of technical points for all directions of Python, forming a summary of knowledge points in various fields. Its usefulness lies in the fact that you can find corresponding learning resources based on the knowledge points above, ensuring a comprehensive learning experience.
-
2. Essential Development Tools for Python
-
3. Python Video Collection
-
Watching zero-based learning videos is the quickest and most effective way to learn. Following the teacher’s thought process in the videos, from basics to advanced, makes it easy to get started.
-
4. Practical Cases
-
Theoretical knowledge is useless; you need to learn by practicing hands-on to apply what you have learned. At this point, you can work on practical cases to learn.
-
5. Python Practice Questions
-
Check your learning results.
-
6. Interview Materials
-
We learn Python to find high-paying jobs, and the following interview questions are the latest materials from leading internet companies like Alibaba, Tencent, and ByteDance, with authoritative answers provided by experts from Alibaba. After completing this set of interview materials, I believe everyone will be able to find a satisfactory job.
How to obtain
1. Like + View
2. Reply “1” in the background