Linux debian install pip

Как установить Pip на Debian 9

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

Это руководство проведет вас через установку Python Pip в Debian 9 и научит, как устанавливать пакеты Python и управлять ими с помощью pip.

Подготовка

Прежде чем продолжить это руководство, убедитесь, что вы вошли в систему как пользователь с привилегиями sudo .

Стоит отметить, что если вы хотите установить модуль python глобально, вы должны предпочесть установить его как пакет с помощью менеджера apt . Используйте pip для глобальной установки модулей Python, только если пакет недоступен.

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

В следующих разделах мы покажем вам, как установить pip для Python 2 pip и Python 3 pip3 с помощью диспетчера пакетов apt .

Установите Pip для Python 2

Выполните следующие действия, чтобы установить Pip для Python 2 в вашей системе Debian:

    Начните с обновления индекса пакетов:

sudo apt install python-pip
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Установить pip для Python 3

Выполните следующие действия, чтобы установить Pip для Python 3 в Debian:

    Сначала обновите список пакетов:

sudo apt install python3-pip
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)

Использование пункта

В этом разделе мы покажем вам несколько полезных базовых команд pip. С помощью pip мы можем устанавливать пакеты из PyPI, системы контроля версий, локальных проектов и из файлов распространения, но в большинстве случаев вы будете устанавливать пакеты из PyPI.

Допустим, мы хотим установить пакет с именем croniter , мы можем сделать это, выполнив следующую команду:

Чтобы удалить пакет, выполните:

pip uninstall package_name

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

Чтобы просмотреть установленные пакеты:

Чтобы перечислить устаревшие пакеты:

Package Version Latest Type ------------- ------- ------ ----- cryptography 1.7.1 2.2.2 wheel enum34 1.1.6 1.1.6 wheel idna 2.2 2.7 wheel ipaddress 1.0.17 1.0.22 wheel keyring 10.1 13.0.0 wheel keyrings.alt 1.3 3.1 wheel pip 9.0.1 10.0.1 wheel pyasn1 0.1.9 0.4.3 wheel pycrypto 2.6.1 2.6.1 sdist pygobject 3.22.0 3.28.3 sdist pyxdg 0.25 0.26 wheel SecretStorage 2.3.1 2.3.1 sdist setuptools 33.1.1 39.2.0 wheel six 1.10.0 1.11.0 wheel wheel 0.29.0 0.31.1 wheel 

Выводы

В этом руководстве мы показали вам, как установить pip в вашей системе Debian и как управлять пакетами Python с помощью pip. Дополнительные сведения о pip см. В руководстве пользователя pip .

Читайте также:  Mac os qemu linux

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

Источник

Installation#

If your Python environment does not have pip installed, there are 2 mechanisms to install pip supported directly by pip’s maintainers:

ensurepip #

Python comes with an ensurepip module [ 1 ] , which can install pip in a Python environment.

$ python -m ensurepip --upgrade
$ python -m ensurepip --upgrade

More details about how ensurepip works and how it can be used, is available in the standard library documentation.

get-pip.py #

This is a Python script that uses some bootstrapping logic to install pip.

  • Download the script, from https://bootstrap.pypa.io/get-pip.py.
  • Open a terminal/command prompt, cd to the folder containing the get-pip.py file and run:

More details about this script can be found in pypa/get-pip’s README.

Standalone zip application#

The zip application is currently experimental. We test that pip runs correctly in this form, but it is possible that there could be issues in some situations. We will accept bug reports in such cases, but for now the zip application should not be used in production environments.

In addition to installing pip in your environment, pip is available as a standalone zip application. This can be downloaded from https://bootstrap.pypa.io/pip/pip.pyz. There are also zip applications for specific pip versions, named pip-X.Y.Z.pyz .

The zip application can be run using any supported version of Python:

then the currently active Python interpreter will be used.

Alternative Methods#

Depending on how you installed Python, there might be other mechanisms available to you for installing pip such as using Linux package managers .

These mechanisms are provided by redistributors of pip, who may have modified pip to change its behaviour. This has been a frequent source of user confusion, since it causes a mismatch between documented behaviour in this documentation and how pip works after those modifications.

If you face issues when using Python and pip installed using these mechanisms, it is recommended to request for support from the relevant provider (eg: Linux distro community, cloud provider support channels, etc).

Upgrading pip #

Upgrade your pip by running:

$ python -m pip install --upgrade pip
$ python -m pip install --upgrade pip
C:> py -m pip install --upgrade pip

Compatibility#

The current version of pip works on:

pip is tested to work on the latest patch version of the Python interpreter, for each of the minor versions listed above. Previous patch versions are supported on a best effort approach.

Other operating systems and Python versions are not supported by pip’s maintainers.

Users who are on unsupported platforms should be aware that if they hit issues, they may have to resolve them for themselves. If they received pip from a source which provides support for their platform, they should request pip support from that source.

The ensurepip module was added to the Python standard library in Python 3.4.

Источник

Install Python PIP Debian 11

“Pip is the most popular package installer for Python. You may manage and install new python-based software packages using PIP, a Python command-line package manager. However, users can install its dependencies and do package searches in the Python packages index using this tool. Most Linux operating systems do not come pre-installed with the Python pip tools. Fortunately, you can manually install the python-pip tool on Debian and other Linux distributions.

Today, we will show in this article how to install python-pip packages on the Debian 11 bullseye distribution through the command line application. Almost all steps are similar, so by following these guidelines, you can install python-pip on Ubuntu and its derivates.”

How to Install Python Pip on Debian 11 Bullseye Distribution?

Python has two different versions, python2 and python3. But, the pip installation in Python2 has been obsoleted now. However, you can install pip for Python3, which is available in all Linux distributions. Open the terminal from the application menu using the search bar:

Now, perform the below steps to start the installation of a python-pip on the Debian 11 system:

How to Install Pip for Python3?

The following steps are included while you are installing the pip tool for python3 on Debian 11:

Step 1: Update System Packages
Update the system packages repository list using the following command:

Step 2: Verify Python Installation
Python3 is installed by default in Debian 11 and other major Linux distributions. So you don’t need to install it again. But, ensure the Python3 installation by executing the following command:

The installed version will be displayed on the terminal. Now, start installing the pip tool for Python3.

Step 3: Install Pip for Python3
Execute the following command to install python-pip tools along with all dependencies on Debian 11 bullseye distribution:

Step 4: Verify Pip Installation
Verify the pip installation by using the following command:

How to Use Python Pip in Linux?

We will also explore the use of pip in this article. Using pip, the user can install python packages from PyPI, local projects, version control, and other project distributions. Usually, the pip would be used inside the virtual environment. Python virtual environment allows you to install python packages inside an isolated space without disturbing the other python project modules.

Let’s discuss some useful pip commands.

With pip, you can list all packages as follows:

You can search for a package through pip by using the following command:

With pip, you can install a python package from PyPI as follows:

For example, we want to install a python package “scrapy” through pip. So, the following command you need to enter on the terminal:

You can also display the package information by using the following command:

The following command you can use to remove or uninstall a package through pip3:

To uninstall the scrapy package, run the below-mentioned command:

That’s all about the basic commands of the pip tool. To explore more commands and options about pip, run the following command on the terminal:

All pip commands and options will be displayed on the terminal as follows:

How to Uninstall Pip From Linux Debian 11 Distribution?

You can uninstall the python-pip package manager from your Linux system by using the following command:

The above command will uninstall pip tools from your system. You will see this output on the terminal:

Conclusion

In this article, we learned how to install the python-pip tool for python 3 on the Debian 11 bullseye system. We have executed various commands to understand the use of pip. Moreover, we have also explained in this article the use of the pip tool. I hope using the above guidelines; you can now easily install and use python-pip tools on your Linux system.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.

Источник

Оцените статью
Adblock
detector