Ошибка unable to locate package в ubuntu

How to install pip on Ubuntu, Linux Mint and other Ubuntu-based distributions

Ubuntu 18.04 has both Python 2 and Python 3 installed by default and hence it has two possible variants of PIP for each Python versions. Pip, by default, refers to the Python 2 version. Pip for Python 3 is referred to as pip3. 

Python 2 is deprecated and not available in Ubuntu 20.04 and higher versions. You can only install PIP3.

First, make sure that Python 3 is installed on Ubuntu. To check that, use this command:

If it shows you a number like Python 3.6.6, Python 3 is installed on your Linux system.

Now you can install pip3 using the command below:

You should verify that pip3 has been installed correctly using this command:

It should show you a number like this:

This means that pip3 is successfully installed on your system.

Install pip for deprecated Python 2 version (for Ubuntu 18.04 only)

If you really need pip2 for some reason, here’s what you need to do.

First, make sure that you have Python 2 installed. On Ubuntu, use the command below to verify.

If there’s no error and a valid output that shows the Python version, you have Python 2 installed. So now you can install pip for Python 2 using this command:

It will install pip and a number of other dependencies with it. Once installed, verify that you have pip installed correctly.

It should show you a version number, something like this:

This mans that you’ve successfully installed pip on Ubuntu.

Recommended Read:

How to use pip commands

Now that you’ve installed pip, let’s quickly see some of the basic pip commands. These commands will help you use pip commands for searching, installing and removing Python packages.

To search for packages in the Python Package Index, you can use the following pip command:

For example, if you search on ‘stress’, it will show all the packages that have the string ‘stress’ in their name or description.

If you want to install an application using pip, you can do so in the following manner:

The above command will install the Python package for all users on your Linux system. Pip doesn’t support tab completion so the package name needs to be exact. It will download all the necessary files and install that package.

If you want to remove a Python package installed via pip, you can use the remove option.

You can use pip instead of pip3 in the above commands if you are using pip2 in Ubuntu 18.04. 

I hope this quick tip helped you install pip on Ubuntu. If you have any questions or suggestions, please let me know in the comments section below.

What is pip?

Pip stands for “Pip Installs Packages”. Pip is a command-line based package management system. It’s used to install and manage software written in the Python language.

You can use pip to install packages listed in the Python Package Index  (PyPI).

As a software developer, you can use pip to install various Python modules and packages for your own Python projects.

As an end user, you may need pip for installing some applications that are developed using Python and can be installed easily using pip. One such example is the Stress Terminal application, which you can easily install with pip.

Let’s see how you can install pip on Ubuntu and other Ubuntu-based distributions.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *