Ubuntu is a commonly used operating system especially for developers and technology enthusiasts. In the Ubuntu system, pip3 is an extremely useful package management tool, which can be used to install and manage Python third-party libraries. This article will introduce how to install pip3 under Ubuntu system and provide specific code examples.
Update system
Before installing pip3, you first need to ensure that the Ubuntu system has been updated to the latest version. Open the terminal and enter the following command to update the system:
sudo apt update sudo apt upgrade
Install pip3
Generally speaking, the Ubuntu system has integrated pip3 and can be installed directly through the following command:
sudo apt install python3-pip
Verify installation
After the installation is completed, you can use the following command to verify whether pip3 is installed successfully:
pip3 --version
If the version information of pip3 can be output, the installation is successful.
Modify the source of pip3
Since by default, the source of pip3 uses a foreign server, the download speed may be slow. We can modify the source of pip3 and change it to a domestic mirror source to improve download speed. The following is a commonly used domestic mirror source address, which can be changed by entering the following command in the terminal:
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
In this way, pip3 will automatically use the Tsinghua mirror source for downloading in subsequent operations.
Use pip3 to install Python third-party libraries
After installing pip3, we can use it to install Python third-party libraries, such as to install the requests library, you can enter the following in the terminal Command:
pip3 install requests
In this way, pip3 will automatically download and install the requests library from the mirror source. It should be noted that if you install other libraries, you only need to replace requests
with the corresponding library name.
Upgrade installed libraries
Sometimes, we need to upgrade installed libraries to the latest version. Using pip3 can easily perform upgrade operations. The following is an example command for upgrading the requests library to the latest version:
pip3 install --upgrade requests
Summary:
This article introduces a simple and fast method to install pip3 under Ubuntu system, and provides Specific code examples. With these steps, you can easily install pip3 and use it to manage and install third-party libraries for Python. At the same time, modifying the source of pip3 can increase the download speed and make your development work more efficient. Hope this article is helpful to you!
The above is the detailed content of A simple and fast way to install pip3 on Ubuntu system. For more information, please follow other related articles on the PHP Chinese website!