Home >Backend Development >Python Tutorial >Install and configure pip3 to manage Python packages using Ubuntu
Use Ubuntu to install pip3 for Python package management
Overview:
pip is a Python package management tool used to install and manage Python packages. In the Ubuntu system, we can use pip3 for Python3 package management. This article will introduce how to install pip3 in Ubuntu system and provide specific code examples.
Steps:
Update system:
Before any software installation, you first need to update the system. Open the terminal and run the following command:
sudo apt update sudo apt upgrade
Install pip3:
After updating the system, next we need to install pip3. Run the following command:
sudo apt install python3-pip
Verify pip3 installation:
After the installation is complete, we can verify whether pip3 is successfully installed by running the following command:
pip3 --version
Use pip3 to install Python packages:
After installing pip3, we can use it to install Python packages. Here are some example commands:
Install a single package:
pip3 install package_name
Install a specific version of a package:
pip3 install package_name==version_number
Install the package from the requirements.txt file:
pip3 install -r requirements.txt
Please note that package_name
in the above command is the name of the Python package to be installed,version_number
is the specific version number of the package to be installed. The requirements.txt file is a text file that contains all the packages to be installed and their version numbers, one per line.
Update Python package:
Sometimes it is necessary to update the installed Python package to the latest version. You can use the following command to update one or more packages:
pip3 install --upgrade package_name
Uninstall a Python package:
If you need to uninstall an installed Python package, you can run the following command:
pip3 uninstall package_name
Conclusion:
By installing pip3, we can easily install, upgrade and uninstall Python packages. This article introduces the steps to install pip3 in Ubuntu system and provides some common usage examples. I hope this article will be helpful to beginners in Python package management on Ubuntu.
The above is the detailed content of Install and configure pip3 to manage Python packages using Ubuntu. For more information, please follow other related articles on the PHP Chinese website!