pygame - 安装pygame时如何处理'ModuleNotFoundError:没有名为'pygame'的模块'?
问题描述
我使用 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
解决方案
推荐阅读
- javascript - 为什么 webpack 5 忽略一个文件中的 NODE_ENV,但读取另一个文件
- c# - 通过变量作为字符串的布尔类型的 NPOI C# SetCellValue()
- elixir - 会话到期后,凤凰服务器主索引页面无法正确重定向
- r - 组合多个矩阵并应用百分比和括号格式
- sql-server - 如何将列值与声明的变量进行比较
- python - 如何解决 IPython 中 Selenium 的“进程意外关闭,状态为 11”?
- java - 更新页面和单选按钮在 html 中消失
- xmonad - 在 xmonad 中,有些键绑定有效,有些则无效?
- docker - Docker Compose - 将挂载目标设置为 dockerfile 中指定的卷
- r - 从 mutate_at() 更改为 mutate(across()) 函数问题