报错信息:
C:\Users\SUN>pip install pygame
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pygame in c:\users\sun\appdata\roaming\python\python38\site-packages (2.1.2)
原因分析:
需要指定路径
解决方案:
使用 pip install --target=安装路径
如:pip install --target=c:\users\sun\appdata\roaming\python\python38\site-packages pygame
注意:--target=后紧跟安装路径无需空格
执行结果:
C:\Users\SUN>pip install --target=c:\users\sun\appdata\roaming\python\python38\site-packages pygame
Collecting pygame
Using cached pygame-2.1.2-cp38-cp38-win_amd64.whl (8.4 MB)
Installing collected packages: pygame
Successfully installed pygame-2.1.2
可使用 pip list 查看是否成功安装
