GASP的安装和执行
来源:互联网 发布:ip网络功放怎么设置 编辑:程序博客网 时间:2024/06/15 12:47
GASP (Graphics API for Students of Python) will enable us to write programs involving graphics.
安装Windows版GASP
在《How to Think Like a Computer Scientist Learning with Python 》4.11GASP章节中,需要安装GASP。通过文章给的网址http://dev.laptop.org/pub/gasp/downloads进入下载页面。由于我是windows 7系统,所以选择
3.Microsoft Windows
The latest version of GASP does not run on Windows, due to unfortunate
implementation details. In the meantime, you can use older versions of
GASP from the 0.2.x series. Install PyGame, then download and install
the 0.2.0beta1 GASP package. Assistance with porting the 0.3.x series
is appreciated, email the mailing list if you can help.
1.首先安装PyGame,通过页面链接,进入http://www.pygame.org/wiki/GettingStarted
通过描述得知,在dos里面输入pip install pygame 即可
但是我在这个过程中,第一次失败了,仔细看错误描述,要求先更新pip的版本。更新pip后,成功安装pygame
2.下载python-gasp-0.2.0beta1.win32.exe,双击安装。
由于我是windows 64系统,gasp是32位的,一开始提示no python installation found in the registry。
解决办法:
win+r,输入regedit,在注册表新建HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Python/PythonCore/2.7/InstallPath 项,并把HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/2.7/InstallPath的数据复制到上面新建的项里面
现在可以在Python27\Lib\site-packages路径下看见多了gasp,gasp-0.2.0beta1-py2.6.egg-info,pygame,pygame-1.9.3.dist-info 4个文件夹
执行
复制教材的脚本,命名为“gasp.py”
from gasp import *begin_graphics()Circle((200, 200), 60)Line((100, 400), (580, 200))Box((400, 350), 120, 100)update_when('key_pressed')end_graphics()
运行发现一直报错,
c:\>python gasp.pyTraceback (most recent call last): File "gasp.py", line 1, in <module> from gasp import * File "c:\gasp.py", line 3, in <module> begin_graphics()NameError: name 'begin_graphics' is not defined
这个问题把头都搞大了。最后在同事的帮助下,发现跟pygame有关系。他没有安装pygame,报的错跟我一样。但是我是已经安装了pygame,也许是版本兼容问题吧。最后只能把gasp.py脚本放到C:\Python27\Lib\site-packages 文件夹才能成功运行。
如果有朋友知道是什么原因,请留言,感谢~!
- GASP的安装和执行
- 从Dying gasp功能看Linux的响应速度
- Dying Gasp
- Deepin下安装Oracle Java出现Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp问题解决方案
- 【java】Deppin 解决JDK出现Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp的问题
- java开发软件的安装和执行环境的设置
- 如何准备和执行 Visual Studio 6.0 的全新安装
- STATSPACK安装后执行STATSPACK.SNAP和@spreport后的执行报告。仅供参考
- 同时安装了python2和python3如何便捷的执行文件和pip操作
- 编译执行和解释执行的区别
- 编译执行和解释执行的区别
- 编译执行和解释执行的区别
- sql的执行原理和执行顺序
- 编译执行和解释执行的区别
- 编译执行和解释执行的区别
- 解释执行和编译执行的区别
- 编译执行和解释执行的区别
- PrintN的循环执行和递归执行
- Hashtable和HashMap的区别
- mysql 用户管理和权限设置
- 软件测试的测试思路总结
- 浏览器加载网页时的过程
- Unity:Transform之四元数的移动端单指滑动旋转模型操作
- GASP的安装和执行
- 几道与背包九讲相关的题目(HDU - 1712,3033,2844,2159)
- 关于如何建立网站 和 花生壳映射动态ip
- 关于cmd中执行命令路径包含空格的解决办法
- 自定义控件之画圆及自定义属性
- pImpl的高级用法
- Linux之旅
- c\c++中单冒号(:)和双冒号(::)的用法
- 从程序看数组指针