Pip uses a different python version than the one I installed

Question:

I installed Python 3.8.2 on Mac OS with Homebrew. I added the directory to PATH, but it seems to have installed wrong versions. I tried to install pygame with pip3, but when I ran the .py with python3, it told me the module was missing. pip3 --version tells me it uses Python 3.7. However, pip3.8 --version tells me it uses Python 3.8. Both python3 --version and python3.8 --version show “Python 3.8.2”. I’m really confused – is there something really obvious that I’m missing? Did Python not find pygame because pip installed it on another version of Python?

Asked By: CJames

||

Answers:

First, always use virtual environments and do not install packages globally.

Second, I was back then dealing with this confusion, too. After lots of research, I gave up and finally decided to go with the following command, even though I would want to just type pip or pip3.

python3.8 -m pip install pygame

This way, you install the package(pygame here) for a specific version of python(3.8 here).

You can find something more detailed in here.

Answered By: muyustan

Reinstall pip using your current python:

python3 -m pip install -U pip
Answered By: Poma
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.