想着通过学习小游戏来熟悉python,准备工作的第一步就是安装pygame模块,
1.我尝试用命令行pip install pygame安装导入模块,结果报错
百度之后发现不用进入python直接pip install pygame就可以直接安装了
2.安装过程中又报错..
WARNING: You are using pip version 20.0.2; however, version 20.1 is available.
You should consider upgrading via the 'd:\python37\python.exe -m pip install --upgrade pip' command.
然后我就运行了pip install --upgrade pip' command这个,
结果显示ModuleNotFoundError: No module named 'pip'
3.通过运行这2行命令就解决了ModuleNotFoundError: No module named 'pip'
python -m ensurepip
python -m pip install --upgrade pip
4.接下来重新试试pip install pygame
提示我 Requirement already satisfied......
运行:pip install --target=d:\python\python37\lib\site-packages pygame
然后安装成功,pip list看看,安装上了...
心累