Install pip linux centos

Installing pip/setuptools/wheel with Linux Package Managers¶

This section covers how to install pip , setuptools , and wheel using Linux package managers.

If you’re using a Python that was downloaded from python.org, then this section does not apply. See the Requirements for Installing Packages section instead.

Note that it’s common for the versions of pip , setuptools , and wheel supported by a specific Linux Distribution to be outdated by the time it’s released to the public, and updates generally only occur for security reasons, not for feature updates. For certain Distributions, there are additional repositories that can be enabled to provide newer versions. The repositories we know about are explained below.

Also note that it’s somewhat common for Distributions to apply patches for the sake of security and normalization to their own standards. In some cases, this can lead to bugs or unexpected behaviors that vary from the original unpatched versions. When this is known, we will make note of it below.

Fedora¶

sudo dnf install python3-pip python3-wheel

To learn more about Python in Fedora, please visit the official Fedora docs, Python Classroom or Fedora Loves Python.

CentOS/RHEL¶

CentOS and RHEL don’t offer pip or wheel in their core repositories, although setuptools is installed by default.

To install pip and wheel for the system Python, there are two options:

    Enable the EPEL repository using these instructions. On EPEL 7, you can install pip and wheel like so:

sudo dnf install python3-pip python3-wheel
sudo dnf install python3-pip python3-wheel
sudo dnf upgrade python3-setuptools

To install pip, wheel, and setuptools, in a parallel, non-system environment (using yum) then there are two options:

  1. Use the “Software Collections” feature to enable a parallel collection that includes pip, setuptools, and wheel.
    • For Redhat, see here: https://developers.redhat.com/products/softwarecollections/overview
    • For CentOS, see here: https://github.com/sclorg

Be aware that collections may not contain the most recent versions.

sudo yum install python34u python34u-wheel

openSUSE¶

sudo zypper install python3-pip python3-setuptools python3-wheel

Debian/Ubuntu and derivatives¶

Firstly, update and refresh repository lists by running this command:

sudo apt update sudo apt install python3-venv python3-pip

Recent Debian/Ubuntu versions have modified pip to use the “User Scheme” by default, which is a significant behavior change that can be surprising to some users.

Arch Linux¶

Currently, there is no “copr” yum plugin available for CentOS/RHEL, so the only option is to manually place the repo files as described.

Table of Contents

  • An Overview of Packaging for Python
  • The Packaging Flow
  • Tutorials
  • Guides
    • Installing packages using pip and virtual environments
    • Installing stand alone command line tools
    • Installing pip/setuptools/wheel with Linux Package Managers
    • Installing scientific packages
    • Package index mirrors and caches
    • Hosting your own simple repository
    • Packaging and distributing projects
    • Including files in source distributions with MANIFEST.in
    • Single-sourcing the package version
    • Dropping support for older Python versions
    • Packaging binary extensions
    • Packaging namespace packages
    • Creating and discovering plugins
    • Using TestPyPI
    • Making a PyPI-friendly README
    • Publishing package distribution releases using GitHub Actions CI/CD workflows
    • Tool recommendations
    • Analyzing PyPI package downloads

    Previous topic

    Next topic

    © Copyright 2013–2020, PyPA.
    This page is licensed under the Python Software Foundation License Version 2.
    Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.

    The Python Software Foundation is a non-profit corporation. Please donate.

    Last updated on Jun 16, 2023. Found a bug?
    Created using Sphinx 4.5.0.

    Источник

    Как установить Pip на CentOS 8

    Pip — это система управления пакетами, которая позволяет устанавливать, удалять и иным образом управлять программными пакетами, написанными на Python. Его можно использовать для установки пакетов из индекса пакетов Python (PyPI) и других индексов.

    В этом руководстве мы объясним, как установить pip для Python 2 и 3 на CentOS 8, и рассмотрим основы управления пакетами Python с помощью pip.

    Установка pip на CentOS 8

    Как вы знаете, активно разрабатываются две версии Python: Python 2 и Python 3. По умолчанию в RHEL / CentOS 8 нет неверсированной общесистемной команды python чтобы избежать блокировки пользователей определенной версией Python. Вместо этого он дает пользователю возможность установить, настроить и запустить конкретную версию Python .

    При установке модулей python глобально вы должны предпочесть установку модулей python из репозиториев распространения с помощью dnf или yum поскольку они протестированы на правильную работу в CentOS 8. Используйте pip для глобальной установки модулей python, только если для модуля python нет пакета rpm .

    Имена пакетов модулей Python 2 имеют префикс «python2», а модули Python 3 — «python3». Например, чтобы установить модуль paramiko для Python 3, вы должны запустить:

    sudo dnf install python3-paramiko

    Установка pip для Python 3 (pip3)

    Чтобы установить pip для Python 3 в CentOS 8, выполните следующую команду от имени пользователя root или sudo в своем терминале:

    Чтобы запустить Python 3, вам нужно явно ввести python3 , а для запуска pip type pip3 .

    Убедитесь, что пакет установлен правильно, выполнив следующую команду, которая распечатает версию пакета:

    Номер версии может отличаться, но должен выглядеть примерно так:

    pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6) 

    Чтобы иметь возможность устанавливать и собирать модули Python с помощью pip, вам необходимо установить инструменты разработки:

    sudo yum install python3-develsudo yum groupinstall 'development tools'

    Установка pip для Python 2 (pip2)

    Чтобы установить Python 2 и pip, введите следующую команду:

    Проверьте установку, набрав:

    Результат должен выглядеть примерно так:

    Чтобы выполнить Python 2, введите python2 , а для запуска введите pip2 .

    Установите инструменты разработки:

    sudo yum install python2-develsudo yum groupinstall 'development tools'

    Управление пакетами Python с помощью pip

    Как правило, вы должны использовать pip только в виртуальной среде. Virtual Environments Python позволяют устанавливать модули Python в изолированном месте для конкретного проекта, а не глобально. Таким образом, вам не нужно беспокоиться о влиянии на другие проекты Python.

    В этом разделе мы рассмотрим несколько основных команд pip.

    Чтобы установить модуль python с помощью pip, запустите команду pip install за которой следует имя пакета. Например, чтобы установить пакет с именем twisted , вы должны выполнить следующую команду:

    Если вы хотите установить определенную версию пакета, используйте следующий формат:

    Чтобы удалить пакет, используйте команду pip uninstall за которой следует имя пакета:

    pip uninstall package_name

    Для поиска пакетов из PyPI:

    Установленные пакеты могут быть перечислены с:

    Список устаревших пакетов:

    Чтобы обновить уже установленный пакет до последней версии, используйте следующую команду:

    pip3 install --upgrade package_name

    Выводы

    Мы показали вам, как установить pip в CentOS 8 и как легко устанавливать и удалять модули Python с помощью pip.

    Дополнительные сведения о pip см. В руководстве пользователя pip . Если у вас есть какие-либо вопросы или отзывы, не стесняйтесь оставлять комментарии ниже.

    Источник

    How to Install Pip on CentOS 8

    Pip is a package manager for the Python programming language. Pip makes it easier to install plugins and other software packages for Python.

    There are two versions – the most recent version is for Python 3, and there is a legacy version for the older Python 2.

    This guide will show you how to install Pip for Python 2 and Python 3 on CentOS 8.

    tutorial on how to install Pip package-management system on CentOS 8

    • A system with CentOS 8 installed
    • A user account with sudo or root privileges
    • Access to a command line or terminal window (Activities > Search > Terminal)

    Installing Pip for Python 3

    Python 3 is the most recent, stable, long-term supported version of Python. If you don’t specifically need Python 2 for compatibility with older applications, it’s recommended to use Python 3.

    Step 1: Update System Repositories

    To update system repositories, open a terminal window and enter the following command:

    This will refresh the local list of available software packages. If yum update hasn’t been run recently, it may take a few minutes to install updates.

    Note: For some updates, such as security keys, you may be prompted to confirm the installation with y > Enter .

    Step 2: Install Python 3

    Some newer versions of CentOS 8 include Python 3 by default. If the system already has Python 3 installed, skip this step.

    To install Python 3, open a terminal window and enter the command:

    sudo yum –y install python3

    Step 3: Install Pip for Python 3

    To install Pip for Python 3 open the terminal window, enter the following:

    sudo yum –y install python3-pip

    Install Pip for Python 3 on CentOS 8.

    Note: Your system may already have Python3-pip installed. If so, the output will report that there is nothing to do.

    Step 4: Confirm Pip is Installed

    One way to test whether an application is installed is by checking its version number. To check the version of Pip 3, enter:

    The output displays the pip3 version installed on your system.

    pip 9.0.3 successfully installed

    Note: Make sure to use a capital –V . A lower-case –v will display an error and list of commands.

    Installing Pip for Python 2

    CentOS 8 allows you to install multiple versions of Python at the same time. You can install Python 2 in parallel to an existing Python 3 installation.

    Step 1: Update Repositories

    If you updated the repositories in the previous section, skip to the next step.

    Update repositories with the command:

    Note: Some packages, such as security updates, will prompt you to confirm the installation by typing y and hitting Enter .

    Step 2: Install Pip 2

    To install Pip2, open the terminal window, enter the command:

    sudo yum –y install python2-pip

    Install Pip for Python 2 on CentOS 8

    Note: If Python 2 isn’t installed, this step will install it. Python 2 is a dependency for the pip2 package.

    Step 3: Verify the Installation

    Check the version of pip2 to verify that it is installed on your Centos 8 system:

    The system should display the version of pip2.

    Check Pip 2 version on CentOS 8

    Note: If you’re concerned that Python 2 may not have been installed, verify the installation by entering sudo yum –y install python2 . The system should report nothing to do.

    You have installed Pip for Python 2 and Python 3 on your CentOS 8 system. Use Pip to manage the most popular Python packages easily.

    Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.

    PIP for Python is a utility to manage PyPI package installations from the command line. This tutorial will.

    Pip is a software utility that downloads packages from PyPI — the Python Package Index. Using PIP is like.

    Источник

    Читайте также:  Linux авторизация по паролю
Оцените статью
Adblock
detector