Does python 3.8.2 have ensurepip? Do I need to install ensurepip to use it?

8.6k views Asked by At

I'm using python 3.8.2 on ubuntu on windows 10. I'm reading an OOP pdf and I'm at the third-party libraries section. It says that pip doesn't come with python, but python 3.4 contains a useful tool called ensurepip, which will install it: python -m ensurepip.

But when I press enter, it says no module named ensurepip

/usr/bin/python3: No module named ensurepip

So I thought that I already have pip so I tried to install pygame with pip but it says there's no module named pip. What am I doing wrong?

Thanks.

1

There are 1 answers

4
sinoroc On BEST ANSWER

The module ensurepip is part of Python's standard library. It should be there. You say you're on Windows, but then you show /usr/bin/python3 in your question, which is obviously not a Windows path (rather Linux).

My assumption is that you might be using WSL (or WSL2), which is actually Linux running on Windows (without going into details). By default WSL runs a Ubuntu distribution. This distribution (and other Debian-related distributions) typically breaks up Python and its standard library in multiple pieces.

So you might need to install an additional system package, I believe it could be the python3-venv system package that contains the Python ensurepip module in your case:

sudo apt-get install python3-venv