When I run python -V
on terminal, it outputs Python 3.8.0
but whenever I try to install a library with pip, it always downloads to Python 3.7.
For example, when I run pip3 install pygame
, it outputs Requirement already satisfied: pygame in /usr/local/lib/python3.7/site-packages (1.9.6)
but when I test it with import pygame
, it returns ModuleNotFoundError: No module named 'pygame'
.
I think I installed Python 3.8 incorrectly? I've been using an older version of python with no problems up to now, and I tried installing python 3.8 with pyenv, and ever since then I've had this problem.
My pip is updated: Requirement already up-to-date: pip in /usr/local/lib/python3.7/site-packages (20.0.2)
P.S. Is it just me or do you guys have two folders called Python in both your user library and Macintosh HD library? Also, the 3.7.7 is referring to a totally different folder at Macintosh HD/ussr/local/Cellar/python
... is this normal?
Edit: pip3 --version
returns pip 20.0.2 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
Edit 2: Tried using venv
. A really long error... (the below error message is only the final part of the actual error message)
ERROR: Command errored out with exit status 1: /Users/username/my_venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/g3/8kbv7g411r32xwzp2681_s540000gn/T/pip-install-ywfy_s_y/pygame/setup.py'"'"'; __file__='"'"'/private/var/folders/g3/8kbv7g411r32xwzp2681_s540000gn/T/pip-install-ywfy_s_y/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/g3/8kbv7g411r32xwzp2681_s540000gn/T/pip-record-fxa7km57/install-record.txt --single-version-externally-managed --compile --install-headers /Users/username/my_venv/include/site/python3.8/pygame Check the logs for full command output.
Edit 3: I just tried reinstalling numpy & pandas & matplotlib, it works with pip3.8 install <library>
but pygame doesn't work. Could it be pygame's fault?
Edit 4: Nevermind, I figured it out! Apparently pygame dev 3 wasn't out when Python 3.8 was released, so I have to modify my command to dev 6 with
python3 -m pip install pygame==2.0.0.dev6
... I don't know why it doesn't fetch the latest version by default but it worked so thank you for your help and time!