我正在尝试在系统上安装Pygame,但我不断收到此错误消息
我已经删除并重新安装了python,并尝试安装了多个版本的pygame,但我仍然收到相同的错误消息
pip安装pygame
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x86"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Mahdi\AppData\Local\Temp\pip-install-h3ck287c\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\Mahdi\AppData\Local\Temp\pip-install-h3ck287c\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\Mahdi\AppData\Local\Temp\pip-install-h3ck287c\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\Mahdi\AppData\Local\Temp\pip-install-h3ck287c\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
错误:命令错误,退出状态为1:python setup.py egg_info检查日志以获取完整的命令输出。
答案 0 :(得分:0)
尝试: 1-如果您没有从此处安装pygame文件: https://www.pygame.org/download.shtml 2解压缩文件并打开 3-您将看到一个名为setup的python文件 4-使用python运行它,它应该安装 5,检查是否安装了以下代码:
import pygame, sys
from pygame.locals import *
def main():
pygame.init()
DISPLAY=pygame.display.set_mode((500,400),0,32)
WHITE=(255,255,255)
BLUE=(0,0,255)
DISPLAY.fill(WHITE)
pygame.draw.rect(DISPLAY,BLUE,(200,150,100,50))
while True:
for event in pygame.event.get():
if event.type==QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
main()
您应该看到一个蓝色矩形。
答案 1 :(得分:0)
从循环中删除pygame.init()
pygame.init()
def main():
DISPLAY
然后继续执行程序