前言
在学习python的pygame库的时候,需要安装pygame,然后百度一下怎么安装的,教程基本都是说要下载whl文件,下载地址:https://pypi.org/project/pygame/#files
然后使用python -m pip install --user pygame-xxx-win64.whl安装,这应该是很早版本的安装方法了,导致我那么去安装总是报如下错:
ERROR: pygame-1.9.6-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
解决办法
虽然查看电脑是w64版本的,但是下载w32的就能正常安装,这个具体问题还不清楚,不知道是python判断系统的版本有问题还是我本身系统的问题。
安装pygame的正确姿势
但实际上现在python3.7的版本不需要这么麻烦了,可以直接使用pip命令安装,使用如下命令即可安装:
pip install pygame
当然也可能会报错:
ERROR: Could not find a version that satisfies the requirement pygame (from versions: none) ERROR: No matching distribution found for pygame WARNING: You are using pip version 19.1.1, however version 20.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
那我们就根据提示将pip更新到最近版本就好了。
python -m pip install --upgrade pip
安装很慢的话请更换pip源,如何更换可以参考我上一篇博客。
注意:如果是离线安装当前就只能使用前面那个方法了。
来源:oschina
链接:https://my.oschina.net/u/3696256/blog/3211956