Nội dung
Let’s install PIP on Centos 7 with just a few command lines with AZDIGI.
I. Introduction
What is PIP?
PIP is a package management system that simplifies the installation and management of software packages written in Python, such as those found in the Python Package Index (PyPI). PIP isn’t installed by default on CentOS 7, but the installation is pretty straightforward.
In this tutorial, AZDIGI will walk you through the steps required to install PIP on CentOS 7 using the package manager and cover some basics on installing and managing Python packages using PIP.
When installing python modules, you should prefer installing the python modules provided by the distribution using yum
as they are tested to work properly on CentOS 7. In most cases, you should just use using PIP in a virtual environment. Python Virtual Environments
allows you to install Python modules in an isolated location for a specific project rather than being installed system-wide. This way, you don’t have to worry about affecting other Python projects.
So, please continue to see part II for details on how to install and use it.
II. Implementation Guide
You can install PIP on CentOS 7 with the following 2 steps.
Step 1: SSH into your VPS
First, you need to SSH into your VPS as root, if you don’t know how to SSH, you can see the instructions below:
Step 2: Install PIP and use PIP
1. Enable the EPEL repository
By default, PIP is not available in the CentOS 7 repositories. To install PIP, we need to enable the EPEL repository with the command:
yum install epel-release
2. Install PIP
Once the EPEL repository is enabled, we can install PIP and all its packages with the following command:
yum install python-pip
3. Check PIP
After successful installation, you use the following command to check the version of PIP and Python installed:
pip --version
[root@template ~]# pip --version pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
So my VPS has installed PIP 8.1.2 and Python 2.7.
4. Install development tools
Development tools are required to build Python Modules, you can install them as follows:
yum install python-devel yum groupinstall 'development tools'
5. Manage Python Packages with PIP
First, to be able to see some instructions on how to use PIP, you can use the command:
pip help
Next, we’ll learn a few useful basic PIP commands. With PIP, we can install packages from PyPI, version control, local projects and distribution files. Normally, you would install packages from PyPI.
Install package
For example, if we want to install a package named twisted
, we can do that with the following command:
pip install twisted
twist is an asynchronous networking framework written in Python.
Uninstall package
To uninstall a run package, you can use the following command:
pip uninstall twisted
Upgrade package
To upgrade the package, then you can use the command below:
pip install --upgrade
Search for package
To search for packages from PyPI, you can use the following corresponding command:
pip search "twisted"
List installed packages
To list installed packages, you can use the command:
pip list
List outdated packages
To list outdated packages, you can use the following corresponding command:
pip list --outdated
So you can grasp the basic commands to manage Python with PIP already.
III. Summary
Thus, AZDIGI has shown you how to install PIP on a server using Centos 7 with just a few simple command lines. Installing PIP will help you easily manage Python and improve your VPS operation and use. Hopefully, this article will help you to install Let’s Encrypt SSL successfully!
If you find the article helpful, please share it widely.
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com