我今天看了在Python上安装pygame模块的教程。 我觉得很好。 请共享。
安装Python
额,这个小问题在这里好像很多余呢。 但是为了照顾刚学Python的童鞋,我会更挑剔的吧。
具体如下。
我们要去Python官网。 我去下载需要的版本。 这里下载的是windows64位Python2.7 msi。 如果不知道安装的步骤,请选择默认值。
安装easy_install
这是什么? 我们不需要辛苦。 现在我只要知道它对我们的库的安装有帮助就行了。 的安装过程也很简单,只需下载此库并使用python命令进行安装。
安装pip
那么,经过前面两步,大家(特别是刚入门的童鞋)一定很心烦吧。 为什么需要放这么多东西? 但是,请不要气馁。 好日子就快到了。 pip是释放你设置库的复杂劳动的神器。 看看如何安装pip。
在此之前,请确保windows系统上安装了Python和easy_install。
安装成功标志:
Microsoft windows [6.1. 7600版]
版权所有(c ) 2009微软公司。 保留一切权利。
c :usersadministrator python
python2.7. 11 (v 2.7.11:6 d1b 6a 68f 775,dec 52015,20336040:30 ) [MSC v.1500 64 bit (
AMD64 ) ] on win32
Type 'help '、' copyright '、' credits ' or ' license ' for more information。
exit () )
c :usersadministrator easy _ install-version
usage : easy _ install [ options ] requirement _ or _ URL .
or: easy_install --help
错误:选项- rnotrecognized
C:UsersAdministrator
然后,将目录切换到python安装目录下的Script文件夹下,然后键入
easy_install pip。 当然,为了方便,可以将此路径放在你的环境变量中。 (关于如何配置,网上很多相关教程也很详细。 我不重复做车轮)。
验证一下:
c :usersadministrator pip-v
Usage:
pip [选项]
Commands:
安装安装软件包。
下载下载包。
非安装非安装软件包。
freezeoutputinstalledpackagesinrequirementsformat。
列表列表已安装软件包。
showshowinformationaboutinstalledpackages。
search Search PyPI for packages。
wheelbuildwheelsfromyourrequirements。
hashcomputehashesofpackagearchives。
完成ahelpercommandusedforcommandcompletion
帮助显示帮助。
通用选项s :
-h,- -帮助显示帮助。
- isolatedrunpipinanisolatedmode,ignoring
环境变量标准配置。
-v,--verbosegivemoreoutput.optionisadditive,and can be
用户上传到3时间。
-V,- -版本显示版本和退出。
-q,--quiet Give less output。
--log path to a verbose appending log。
--proxy Specify a proxy in the form
[ user : passwd @ ] proxy.server :端口。
- retriesmaximumnumberofretrieseachconnectionshould
attempt (默认5时间)。
- timeoutsetthesockettimeout (默认15 seconds )。
- exists-actiondefaultactionwhenapathalreadyexists 3360
(s ) witch,(I ) gnore,(w ) ipe,(b ) ackup。
-可信- hosttzdhythishostastrusted,even though it does
not have valid or any HTTPS。
--cert Path to alternate CA bundle。
- client-certpathtosslclientcertificate,a单次文件
连续性专用密钥缓存
in PEM格式。
--cache-dir
--no-cache-dir Disable the cache。
- -禁用- pip-version-check
don ' tperiodicallycheckpypitodetermine
whetheranewversionofpipisavailablefor
download.implied with---- no-index。
C:UsersAdministrator
安装pygame
在安装pygame的前提下,必须先下载这个文件。 所以需要下载。 下载pygame文件。 我记得对应你的Python版本下载哦。
下载结束后,您会发现它是一个. whl后缀的文件。 这很尴尬。 怎么打开?
答案是使用另一个工具,wheel。 wheel本质上是zip包格式,用于安装python模块(使用. whl扩展名),并取代了Eggs。 wheel还提供了bdist_wheel作为设置工具的扩展命令。 此命令可用于生成wheel包。 wheel,检查安装是否成功。
安装wheel的方式这次很爽。 因为我们已经有pip了。
Pip安装工具。 结束了。
现在回顾一下,进入pygameXXXXX.whl的目录,wheel文件名.是的,完全结束了。
我来验证一下
c :usersadministrator python
python2.7. 11 (v 2.7.11:6 d1b 6a 68f 775,dec 52015,20336040:30 ) [MSC v.1500 64 bit (
AMD64 ) ] on win32
Type 'help '、' copyright '、' credits ' or ' license ' for more information。
导入页面
树上有误报,这说明我们安装成功了。 接下来开始愉快的pygame之旅吧。
总结
整体安装过程非常烦恼。 特别是刚入门的童鞋。 但是,这也是最有价值的经历。 因为安装这些库后,您将更熟悉Python的体系结构。 整体结构的把握也会更好。
所以,xqdxt。 只需一步一步地进行操作。 我相信这对你的Python有很大的帮助。 我希望编剧也能多多支持。