我在MacOS上使用终端通过键入以下命令来安装pygame:
python -m pip install --user pygame
随后,它给了我
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pygame
Downloading pygame-1.9.6-cp27-cp27m-macosx_10_11_intel.whl (4.9 MB)
|████████████████████████████████| 4.9 MB 2.0 MB/s
Installing collected packages: pygame
Successfully installed pygame-1.9.6
当我去使用import pygame
时,它会给我ModuleNotFoundError: No module named 'pygame'
。
如何解决此问题?
我还输入了“ which -a python python3”,它给出了以下内容:
/usr/bin/python
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
/usr/local/bin/python3