19.10 pip for python 3.8

I have installed python3.8 to python 19.10:

 sudo apt install python3.8

I now want to install pip for python 3.8

 python3.8 -m pip install pip
 Requirement already satisfied: pip in /usr/lib/python3/dist-packages (18.1)

But the pip 3 is 3.7

 pip3 -V
 pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

So that, for example :

pip3 install pyinotify
Requirement already satisfied: pyinotify in ./.local/lib/python3.7/site-packages (0.9.6)

Attempting to import pyinotify to a python3.8 script throws a ModuleNotFound error


In order to make sure you are using the correct pip, please use it as follows:

python3.8 -m pip install pyinotify

Brett Cannon, one of the Python core developers, just recently published a blog article about this topic: https://snarky.ca/why-you-should-use-python-m-pip/

This all said, you usually want to install Python packages into a virtual environment, not in the system Python.

https://realpython.com/python-virtual-environments-a-primer/


sudo apt install python3-pip or python3.8-pip .

Let the system manage your Python version.


Edit:

The original question was trying to install pip via python -m pip, and after the original poster used apt, the system package manager, instead, they were able to get pip working correctly.

As noted in the comments and in jugmac00's answer, it is now recommended to use pip by calling as a Python module:

python -m pip install pyinotify

If multiple versions of Python are installed on the system and this isn't the default version, you may need to specify the version:

python3.8 -m pip install pyinotify