Score:0

Older version of python can't access 'python3-distutils'

fr flag

TLDR: There are two version of Python on my system. The older version can't access distutils.

I am running a fresh install of Ubuntu 22.04.
The distro comes with two versions of python already installed: Python 3.10 & Python 3.9 and no instances of pip.

I've installed pip by running:

sudo apt install python3-pip

That makes pip available for Python 3.10. I can confirm that by:

$ python3.10 -m pip --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

However, pip is not working for Python 3.9. See:

$ python3.9 -m pip --version
Traceback (most recent call last):
...
from distutils.cmd import Command as DistutilsCommand

ModuleNotFoundError: No module named 'distutils.cmd'

python3-distutils is installed (v 3.10 only):

$ apt list --installed | grep distutils
python3-distutils/jammy-updates,jammy-updates,now 3.10.6-1~22.04 all [installed]

I can't install python3-distutils version 3.9:

$ sudo apt install python3.9-distutils
E: Unable to locate package python3.9-distutils
E: Couldn't find any package by glob 'python3.9-distutils'

Question How to make distutils available for Python 3.9 so pip works with the version of Python.

Raffa avatar
jp flag
"Question How to make distutils available for Python 3.9 so pip works with the version of Python." ... Answer: create a virtual environment https://askubuntu.com/a/1348136/968501
karel avatar
sa flag
Does this answer your question? [How to install latest version of python 3.9.5 on Ubuntu 20.04?](https://askubuntu.com/questions/1347748/how-to-install-latest-version-of-python-3-9-5-on-ubuntu-20-04)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.