In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to build the Python environment, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. How to install Python
Enter the official website of Python installation: https://www.python.org/downloads/
The download interface of Python is shown in the picture.
You can download the Python version of the Windows,Linux,Mac system here. Take the installation method of Window system as an example, click Download Python 3.8.2 to start downloading files, but because this is a foreign website, our download speed may be slow, so I will provide you with a high-speed download link.
Python Quick download Link: https://lanzous.com/ibzg88d
After downloading the above files, double-click python-3.8.2.exe, which is the downloaded file. This will pop up the interface.
Remember to check the box before Add Python 3.8 to PATH, so that you can type Python or py directly on the command line to open the Python interpreter without having to type a path like C://Users/25726/Appdata/Local/Programs/Python/Python38-32/Python.exe to open the Python interpreter.
After checking, open Customize installation and check python launcher and pip. Anyway, check if you can.
When checked, click Install Now, which means to start the installation, the interface in the installation below
After a successful installation, it looks like this.
Next, verify that Python is installed correctly. Verification method: press Win (the key of the four squares in the lower left corner) + r, and the interface appears
Type cmd at this time, then click OK, and a black box appears on the command line
Then type python-- version, and this will be the result if it is installed correctly
If it is not installed correctly, please double-click the downloaded file to install here, and be sure to check all the options!
By the way, typing Python-version shows that python is not an internal command probably because you did not check the python interpreter, python launcher, or add to PATH during installation.
To reinstall the Python interpreter, double-click the original file, then see the following interface, click Modify, then check all and press Next
Check all and press Next
In the above picture, you only need to check two, then install, and then it's a success.
The above is the installation of the Python environment, but the point I want to talk about is the choice of Python editor.
After installing Python, Python also provides a Python editor, that is, Python idle, but this editor is very weak, the interface is ugly, and it is difficult to type the code, so here are two editors: Sublime Text and VS Code
two。 Installation of editor
Sublime Text 3
Features: lightweight, powerful, support for multiple languages.
Nagging: as mentioned earlier, the installation environment should not jam the novice Python, but using Sublime Text3 to build the environment will jam the novice, so I specially pack and share the Sublime Text I have built for you.
Right out of the box, the personalized Sublime Text I built for Python is equipped with plug-ins such as code completion, simplified Chinese and other plug-ins, so that you can happily start learning Python, especially the code completion plug-in inside Sublime Text, which can prompt you how to use a certain function.
Install Sublime Text
Download link: https://lanzous.com/ibzg6gj
After the download is completed, extract the downloaded Sublime Text.zip file and enter the extracted folder. The sublime_text.exe in the following picture is Sublime Text. Double-click it to run it. Here is a tip. You can right-click the sublimetext.exe file, then select add Shortcut, and then copy and paste the shortcut to the desktop to quickly open the Sublime Text. Of course, you can also fix it to the taskbar after Sublime Text is opened. The option to dock to the taskbar pops up by right-clicking the taskbar icon.
Keyboard shortcuts:
Ctrl + n create a new file. By default, the file name is undefined without suffix. You can write the file name .py on the first line of the new file. In this way, the saved file name is the file name, py.
Ctrl+s saves the code. After you create a new file, you should immediately press ctrl+s to save the file and end with .py, so that Subliume Text can correctly highlight syntax and code completion prompts.
Ctrl+/ Quick comment Code
Ctrl+ [indents the selected block of code to the left
Ctrl+] indents the selected block of code to the right
Ctrl+f search
Ctrl+h find and replace
Ctrl+k opens or hides the sidebar, which contains open folders or files
Ctrl+shift+b chooses the compilation system, and I set Python as the compilation system by default. In the English input method, press ctrl+shift+b to pop up: Python3 and Python3-Run two options, it is recommended to choose the second, the second can accept the user's input in the process of running the code, the first can not!
Ctrl+shift+p calls up the command search box to find the commands that come with the plug-in
Ctrl+b if you want to directly use the method of uploading and running Python files, you can press ctrl+b directly, so that the prompt for your choice will not pop up, provided that you have already chosen it last time.
F11 enters the full screen
Here is an example of writing and running a Python file using Sublime Text
1. Open Sublime Text
two。 Press ctrl+n to create a new file
3. Press ctrl+s to pop up the following interface
4.ctrl+shift+b chooses operation method
5. Run successfully interface
6. Note: please press ctrl+shift+b under the English input method. If entering ctrl+shift+b does not pop up the option of step 4, click the tools at the top-Compiler system-Python 3, as shown in the following figure.
The above is the whole process of Sublime Text writing and running Python, which can be said to be out of the box. Here is VS Code.
VS Code
Nagging: known as the first editor in the universe, the open source world's boutique editor, the interface is beautiful and generous, a wide variety of plug-ins, the theme can be changed at will, with plug-ins can happily knock the code.
Installation method:
Open the official website: https://code.visualstudio.com/
After downloading, double-click the downloaded file to enter the installation interface
Click next, and then install
After entering, I found that it is in English, it doesn't matter, you can change the language, change the method.
Press ctrl+shift+x, or the upper left corner: File-preference-settings-extentions, pop up the following interface, then enter chinese, search, select the first installation, and restart VS Code after installation to see the Chinese interface.
Configure the Python environment:
Press ctrl+shift+x, then search for Python and select the first installation
Create and save Python files
Click File-New or directly ctrl+n, then press ctrl+s or right-click to save
Run the Python file
Change theme
As shown in the picture
Then the following interface appears, the arrow keys can preview the theme, press Enter to confirm the replacement, if you want more topics, you can search inside the extension.
Shortcut keys to view:
Enter ctrl+shft+p. This is the search command.
After opening the shortcut, you can right-click an option and select change Shortcut to make changes to the shortcut.
Download links to the files needed to build the environment:
Python
Https://lanzous.com/ibzg88d
Sublime Text
Https://lanzous.com/ibzg6gj
VS Code
Https://lanzous.com/ibzg5li
The above is how the Python environment is built. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.