Home Linux Server How to install PIP on CentOS 7

How to install PIP on CentOS 7

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

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:

AZDIGI Tutorial
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:

AZDIGI Tutorial
yum install python-pip
    

3. Check PIP

After successful installation, you use the following command to check the version of PIP and Python installed:

AZDIGI Tutorial
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:

AZDIGI Tutorial
yum install python-devel
yum groupinstall 'development tools'
    
How to install PIP on Centos 7

5. Manage Python Packages with PIP

First, to be able to see some instructions on how to use PIP, you can use the command:

AZDIGI Tutorial
pip help
    
How to install PIP on Centos 7

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:

AZDIGI Tutorial
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:

AZDIGI Tutorial
pip uninstall twisted
    

Upgrade package

To upgrade the package, then you can use the command below:

AZDIGI Tutorial
pip install --upgrade
    

Search for package

To search for packages from PyPI, you can use the following corresponding command:

AZDIGI Tutorial
pip search "twisted"
    

List installed packages

To list installed packages, you can use the command:

AZDIGI Tutorial
pip list
    

List outdated packages

To list outdated packages, you can use the following corresponding command:

AZDIGI Tutorial
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:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign