Home >Backend Development >Python Tutorial >A simple guide to installing pip on Windows
Simple and easy-to-understand guide to installing pip on Windows, specific code examples are required
When developing using Python, we may often need to install various third-party libraries to extend the functionality of Python. And pip is a very convenient Python package management tool that can help us quickly install and upgrade various Python packages. This article will introduce you in detail how to install pip under Windows system and provide specific code examples.
First, we need to download the latest version of the pip installation file. We can get it by visiting the official website https://pip.pypa.io/en/stable/installing/
. Find "get-pip.py" on the page, right-click the link and select "Save As" to save it locally.
Next, we need to use the "get-pip.py" file to install pip. We can install it through the following steps:
cd
command to switch to the directory where the get-pip.py file is saved. For example, if you save it in the root directory of C drive, you can use the command cd C:
to switch to the root directory of C drive. python get-pip.py
This will automatically download and install the latest version of pip.
We can use the following command to verify whether pip is installed successfully:
pip --version
If the installation is successful, pip will be printed out version number.
Now that we have successfully installed pip, we can use it to install various Python packages. Here are some practical examples:
pip install numpy
pip install Django
pip install --upgrade numpy
By default, pip will download Python packages from official sources. If your access to the official source in China is slow, you can perform the following configuration to replace it with a domestic mirror source. This speeds up package downloads.
C:Users current user name pippip.ini
. [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host = mirrors.aliyun.com
The above is a simple guide to install pip under Windows system. I hope that the introduction in this article can help you successfully install pip and install and upgrade Python packages smoothly.
The above is the detailed content of A simple guide to installing pip on Windows. For more information, please follow other related articles on the PHP Chinese website!