简体   繁体   English

Windows 7 64位 - 安装了Python 2.7.3 64位 - Pygame问题

[英]Windows 7 64bit - Python 2.7.3 64bit installed - Pygame issues

I hope someone can help with this. 我希望有人可以帮忙解决这个问题。

  • I have installed Python 2.7.3 64 bit version 我已经安装了Python 2.7.3 64位版本

  • I have Windows 7 64 bit OS 我有Windows 7 64位操作系统

  • I have installed 64 bit versions of Pygame. 我已经安装了64位版本的Pygame。

They appear to install and the module import without any issue. 它们似乎安装并且模块导入没有任何问题。

When i run some simple script in the console to test: 当我在控制台中运行一些简单的脚本来测试:

import pygame

deepblue = (26,0,255)

mintcream = (254,255,250)

pygame.init()

size = (500,500)

surface = pygame.display.set_mode(size)

pygame window opens. pygame窗口打开。 the background is black 背景是黑色的

i then type : 我输入:

surface.fill(deepblue)

pygame.display.update()

The pygame window should fill with a blue background but just crashes. pygame窗口应该填充蓝色背景,但只是崩溃。 Showing as not responding. 显示为没有响应。

I have tested the same code on 2.7.3 on linux and it works without any issue. 我在linux上测试了2.7.3上的相同代码,它没有任何问题。

I read on the official pygame download site that 64 bit user should use the 32 bit version but i get the same result. 我在官方的pygame下载网站上看到64位用户应该使用32位版本,但我得到相同的结果。

On 64 bit machine should i install 32 bit Python and 32 bit Pygame? 在64位机器上我应该安装32位Python和32位Pygame吗?

Can anyone help with this? 有人能帮忙吗? Has any one else had the same issue? 还有其他人有同样的问题吗?

Is there a installer that gives Python with Pygame already installed? 是否有安装程序为Python安装了Pygame?

Any help much appreciated. 任何帮助非常感谢。

There is no 64bit of pygame on official site and in bitbucket repo of it. 官方网站bitbucket repo中没有64bitpygame

Try to download 64bit of pygame from here . 尝试从这里下载64bitpygame

It have a range of pygame packages form python 2.6 to python 3.4 for 64bit and also for 32bit windows. 一系列pygame包,从python 2.6python 3.4 for 64bit ,也适用于32bit windows。

You should install it in on 64bit Python . 你应该在64位Python上安装它。

Try this instead of update() 试试这个而不是更新()

pygame.display.flip()

Also I had the "Not Responding" problem until I added the following to handle events (inside my game while loop): 在我添加以下内容来处理事件(在循环中我的游戏中)之前,我还有“无响应”问题:

pygame.event.get()

Thank you very much for your help. 非常感谢您的帮助。 It is now fully working. 它现在完全正常运作。

It has been three days of install and uninstall, reading countless web pages and trying to stay awake at work after it LOL! 已经有三天的安装和卸载,阅读无数的网页,并试图在工作后保持清醒!

trail and error of programming I guess :) 编程的踪迹和错误我猜:)

I installed pygame-1.9.2a0.win-amd64-py2.7.exe from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame 我从http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame安装了pygame-1.9.2a0.win-amd64-py2.7.exe

Which installed Pygame version 1.9.2a0 其中安装了Pygame版本1.9.2a0

I changed the code as advised from using update() to flip() 我根据建议更改了代码,使用update()来翻转()

I also used the pygame.event.get within the while loop 我还在while循环中使用了pygame.event.get

The pygame window does not crash as before. pygame窗口不像以前那样崩溃。

I have added the udpated script so others can benefit 我添加了udpated脚本,以便其他人可以受益

import pygame, sys

running = True

deepblue = (26,0,255)
mintcream = (254,255,250)
pygame.init()
size = (500,500)
surface = pygame.display.set_mode(size)
surface.fill(deepblue)
position = (250,250)
radius = 50
linewidth = 2
pygame.draw.circle(surface, mintcream, position, radius, linewidth)
pygame.display.flip()

while running:
    event = pygame.event.wait()
    if event.type == pygame.QUIT:
        running = False
pygame.quit()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM