Article directory
Install Python
To develop Python, you first need to download and configure a Python interpreter.
Download Python
Visit Python official website: https://www.python.org/
Click the downloads button and select the system type (windows/Mac OS/Linux, etc.) in the drop-down box
Choose to download the latest version of Python
Install Python
- Double-click the downloaded Python installation package
- Check the Add Python 3.7 to PATH option in the lower left corner, and then select Install now to install Python immediately.
- The installation is complete
Test whether the installation is successful
- Click the start button in the lower left corner of the computer, and enter cmd to enter the command line mode of windows.
Enter Python in the command line, and the Python version is displayed correctly, which means that Python is installedAdd Python 3.7 to PATH
successfully . configuration.
Configure Python manually
Note: If the Add Python 3.7 to PATH option has been checked during the installation process, and no error is reported when entering the python command in the cmd command mode, then there is no need to manually configure Python.
-
Right click on This PC --> select Properties
-
Select Advanced System Settings --> Environment Variables --> Find and double-click Path
-
Double-click Path, click New in the pop-up box, find the Python installation directory, and add the path to it
-
The newly added path C:\Users\chris\AppData\Local\Programs\Python\Python37 is the directory where the executable file Python.exe is located after Python is installed.
Use 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 -V
to view the version of pip.
If you run pip -V on the command line, the following prompt appears:
It may be because the Add Python 3.7 to PATH option was not checked during the python installation process, and the pip environment variable needs to be manually configured.
-
Right-click on this computer –> Environment Variables –> Find and double-click Path –> Click New in the pop-up window –> Find the pip installation directory and add the path to it.
-
The newly added path C:\Users\chris\AppData\Local\Programs\Python\Python37\Scripts is the directory where the executable file pip.exe is located after Python is installed.
Manage Python packages with pip
pip install <包名>
Install the specified packagepip uninstall <包名>
remove the specified packagepip list
show installed packagespip freeze
Display the installed packages and display them in the specified formatpip install -r required.txt
Install 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, and the default is to download it from the https://files.pythonhosted.org/ website. 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: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:
- Alibaba Cloud http://mirrors.aliyun.com/pypi/simple/
- University of Science and Technology of China https://pypi.mirrors.ustc.edu.cn/simple/
- Douban http://pypi.douban.com/simple/
- Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/
- University of Science and Technology of China http://pypi.mirrors.ustc.edu.cn/simple/
Advanced case
[Python] Python realizes the word guessing game-challenge your intelligence and luck!
[python] Python tkinter library implements GUI program for weight unit converter
[python] Use Selenium to get (2023 Blog Star) entries
Use Tencent Cloud Cloud studio to realize scheduling Baidu AI to realize text recognition
[Xiaobai must see] Python word cloud generator detailed analysis and code implementation
[Xiaobai must see] Python crawls an example of NBA player data
[Must-see for Xiaobai] Sample code for crawling and saving Himalayan audio using Python
[Xiaobai must see] Python crawler data processing and visualization
[Must-see for Xiaobai] Python crawler program to easily obtain hero skin pictures of King of Glory
[Must-see for Xiaobai] Use Python to generate a personalized list Word document
Geospatial data processing and visualization using geopandas and shapely (.shp)
Use selenium to crawl Maoyan movie list data
Detailed explanation of the principle and implementation of image enhancement algorithm Retinex
Getting Started Guide to Crawlers (8): Write weather data crawler programs for visual analysis
Getting started with crawlers (4): The best way to crawl dynamic web pages using Selenium and API
Getting Started Guide to Crawlers (3): Python network requests and common anti-crawler strategies
Getting started with crawlers (2): How to use regular expressions for data extraction and processing
Getting started with reptiles (1): Learn the basics and skills of reptiles
Python object-oriented programming basics and sample code
MySQL database operation guide: learn how to use Python to add, delete, modify and query operations
Python file operation guide: encoding, reading, writing and exception handling
Selenium Automation Toolset - Complete Guide and Tutorials
Python web crawler basics advanced to actual combat tutorial
Pandas data processing and analysis tutorial: from basics to actual combat
Detailed explanation of commonly used data types and related operations in Python
[Latest in 2023] Detailed Explanation of Six Major Schemes to Improve Index of Classification Model