国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

GASP的安裝和執(zhí)行

2019-11-09 19:21:28
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

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章節(jié)中,需要安裝GASP。通過(guò)文章給的網(wǎng)址http://dev.laptop.org/pub/gasp/downloads進(jìn)入下載頁(yè)面。由于我是Windows 7系統(tǒng),所以選擇

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,通過(guò)頁(yè)面鏈接,進(jìn)入http://www.pygame.org/wiki/GettingStarted

通過(guò)描述得知,在dos里面輸入pip install pygame 即可

但是我在這個(gè)過(guò)程中,第一次失敗了,仔細(xì)看錯(cuò)誤描述,要求先更新pip的版本。更新pip后,成功安裝pygame

2.下載python-gasp-0.2.0beta1.win32.exe,雙擊安裝。 由于我是windows 64系統(tǒng),gasp是32位的,一開(kāi)始提示no python installation found in the registry。 解決辦法: win+r,輸入regedit,在注冊(cè)表新建HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Python/PythonCore/2.7/InstallPath 項(xiàng),并把HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/2.7/InstallPath的數(shù)據(jù)復(fù)制到上面新建的項(xiàng)里面

現(xiàn)在可以在Python27/Lib/site-packages路徑下看見(jiàn)多了gasp,gasp-0.2.0beta1-py2.6.egg-info,pygame,pygame-1.9.3.dist-info 4個(gè)文件夾

執(zhí)行 復(fù)制教材的腳本,命名為“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()

運(yùn)行發(fā)現(xiàn)一直報(bào)錯(cuò),

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

這個(gè)問(wèn)題把頭都搞大了。最后在同事的幫助下,發(fā)現(xiàn)跟pygame有關(guān)系。他沒(méi)有安裝pygame,報(bào)的錯(cuò)跟我一樣。但是我是已經(jīng)安裝了pygame,也許是版本兼容問(wèn)題吧。最后只能把gasp.py腳本放到C:/Python27/Lib/site-packages 文件夾才能成功運(yùn)行。 如果有朋友知道是什么原因,請(qǐng)留言,感謝~!


發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 灵石县| 库尔勒市| 广灵县| 吉水县| 桂阳县| 肃宁县| 白朗县| 金堂县| 南陵县| 金山区| 龙川县| 泰顺县| 丹寨县| 余江县| 丹凤县| 卓资县| 胶州市| 南部县| 芒康县| 广元市| 宜川县| 海兴县| 黑龙江省| 太白县| 恭城| 理塘县| 新津县| 铜山县| 东光县| 赤壁市| 射洪县| 上饶市| 哈密市| 靖安县| 克什克腾旗| 阿鲁科尔沁旗| 安仁县| 文登市| 五常市| 积石山| 宣威市|