3
votes

I am running 'which pip' or 'pip -V' on MacOS and its giving me the following location:

pip 20.2.1 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

However, when I try to do 'python -m pip install --user pygame' it says '/usr/bin/python: No module named pip'

Anyone who has come across this problem know how to resolve this issue?

UPDATE:

When I do 'python3 -m pip install --user pygame' or 'python3 install pygame' the following error comes up:

ERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/pygame/setup.py'"'"'; file='"'"'/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/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/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-record-yyyazq6a/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pygame cwd: /private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/pygame/ Complete output (218 lines): ......... ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/pygame/setup.py'"'"'; file='"'"'/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/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/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-record-yyyazq6a/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pygame Check the logs for full command output.

1

1 Answers

-1
votes

I suppose you are ubuntu or any other Linux distribution. I had faced the same error but it is very easy to combat. Use this command to install pip:

sudo apt-get install python3-pip

And then always type pip3 instead of pip. So if you want to install pygame, use this:

pip3 install pygame

rather than this:

pip install pygame