Which option would you prefer to deploy pip to Ubuntu? apt or get-pip.py

Asked 2 years ago, Updated 2 years ago, 103 views

I am troubled because I cannot understand the difference in how to introduce pip with Ubuntu 20.04+Python3.

When deploying pip on Ubuntu, which is better, using apt or get-pip.py?

Eventually, I wanted to use Rundeck's WinRM Node Executor and tried to deploy pywinrm.

installation commands:

  • sudo apt install python3-pip
  • Install to: /usr/bin/pip3

Package to:

  • apt:
    • /usr/lib/python3/dist-packages/
  • sudo pip3 install:
    • /usr/local/lib/python 3.8/dist-packages
  • pip3 install:
    • /home/username/.local/lib/python 3.8/site-packages
  • /usr/lib/python3/dist-packages/
  • /usr/local/lib/python 3.8/dist-packages
  • /home/username/.local/lib/python 3.8/site-packages

With the above configuration, if you use the python CLI on the console, you can use either method of packaging.

However, only pywinrm (python3-winrm) with apt was available from Rundeck's WinRM Node Executor.

I don't understand why the package under /usr/local/lib/is not available, let alone the third one under .local.

When using pip in Ubuntu, is it better to use the following get-pip.py instead of using apt?If Ubuntu officially manages it, I thought I should try it from there, but I couldn't find any satisfactory information.

I would appreciate it if you could give me your advice.

installation commands:

  • curl https://bootstrap.pypa.io/get-pip.py-o get-pip.py
  • python3 get-pip.py

Note: https://pip.pypa.io/en/stable/installing/

python3 ubuntu pip

2022-09-30 15:46

1 Answers

At the beginning of the Installation Guide referenced, Unix (Linux) has the following caveats:

Warning

If you installed Python from a package manager on Linux, you should always install pip for that Python installation using the same source.

If your Python was installed through the OS package manager, install pip from the same source (=Package Manager, apt in this example).

Installation on "get-pip.py" should be used if there is no pip in the distribution package manager or if Python is installed independently from source code etc.


2022-09-30 15:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.