今天想做个飞机大战巩固下python的语法,最近换电脑了还没来得及安装,正好写一篇博客记录一下,因为原理犯过很多错误,在这里记录下来!
一、准备工作
1、python安装包 2、pip安装包 3、pygame安装包
pip下载源:pypi.org/simple/pip/pygame下载源:mirrors.aliyun.com/pypi/simple…
二、开始安装
1、安装python并加入环境变量 安装python过程省略,这里写个添加到环境变量的过程 找到安装python的路径并复制
2、添加python的绝对路径到环境系统变量里保存退出
D:\Python>dir 驱动器 D 中的卷是 Data 卷的序列号是 4662-8122 D:\Python 的目录 ... 2018/08/10 12:01 1,197,370 pip-9.0.1.tar.gz ... D:\Python>tar xf pip-9.0.1.tar.gz D:\Python>cd pip-9.0.1 D:\Python\pip-9.0.1>dir ... 2016/11/07 02:49 2,934 setup.py ... D:\Python\pip-9.0.1>python setup.py install ... ... ... Installed d:\python\lib\site-packages\pip-9.0.1-py3.8.egg Processing dependencies for pip==9.0.1 Finished processing dependencies for pip==9.0.1
找到pip安装位置
加入环境变量
安装方式一 C:\Users\Jack>pip Usage: pip <command> [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. search Search PyPI for packages. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. help Show help for commands. ............... ............ 安装方式二: D:\Python>python pip-20.1.1-py2.py3-none-any.whl/pip install pip-20.1.1-py2.py3-none-any.whl
pip安装完成啦!
二、安装Pygame
查看自己python版本我是3.8版本所以下载3.8版本,先考虑第一个下载,安装失败的话下第二个
2、移动到python安装目录
3、用pip进行安装pygame
D:\Python>dir ... ... 2020/06/26 17:42 4,424,256 pygame-1.9.6-cp38-cp38-win32.whl ... ... D:\Python>D:\Python>pip install pygame-1.9.6-cp38-cp38-win32.whl Processing d:\python\pygame-1.9.6-cp38-cp38-win32.whl Installing collected packages: pygame Successfully installed pygame-1.9.6
pygame安装成功! 赶快去一起做游戏吧!