【问题标题】:How to install PyGame on Python 2.7 (win 64)如何在 Python 2.7 (win 64) 上安装 PyGame
【发布时间】:2016-04-03 10:56:33
【问题描述】:

我想在 win_64 (windows 10) 上的 python 2.7 中安装 pygame,但我给出了一些错误!

 pip install hg+http://bitbucket.org/pygame/pygame

它给了我一个错误:

 Cannot unpack file c:\users\ahmad\appdata\local\temp\pip-xatkk_-    unpack\download.shtml (downloaded from c:\users\ahmad\appdata\local\temp\pip- ki5epe-build, content-type: text/html); cannot detect archive format
 Cannot determine archive format of c:\users\ahmad\appdata\local\temp\pip-ki5epe-build)

运行这个命令:

 c:/python34/scripts/pip install http://bitbucket.org/pygame/pygame

给我:

Cannot unpack file C:\Users\Marius\AppData\Local\Temp\pip-b60d5tho-unpack\pygame 
(downloaded from C:\Users\Marius\AppData\Local\Temp\pip-rqmpq4tz-build, content-type: text/html; charset=utf-8); cannot detect archive format
Cannot determine archive format of C:\Users\Marius\AppData\Local\Temp\pip-rqmp\q4tz-build)

 pip install http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz

给我:

Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\ahmad\\appdata\\local\\temp\\pip-vt49bq-build\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\ahmad\appdata\local\temp\pip-lclwur-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\ahmad\appdata\local\temp\pip-vt49bq-build)

还有一些像这样的错误。

【问题讨论】:

    标签: python windows python-2.7 pygame pip


    【解决方案1】:

    首先到本站http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame下载你需要的版本。打开 cmd 后,导航到您下载 pygame 文件的文件夹并运行 pip install file_name.whl

    如果您没有安装 pip,请从该站点下载它 https://pip.pypa.io/en/latest/installing/ 再次导航到该文件夹​​并在 cmd 中运行 python get-pip.py

    【讨论】:

      【解决方案2】:

      因为你在 Windows 上 pip 是一团糟。考虑继续http://www.pygame.org/download.shtml,然后下载可执行文件或 msi。

      【讨论】:

      • 它也有这个错误:( import pygame File "C:\Python27\lib\site-packages\pygame_init_.py", line 95, in from pygame.base import * ImportError: DLL load failed: %1 is not an valid Win32 application.) 为什么?
      • 另外,页面上写着:windows 64bit users note: use the 32bit python with this 32bit pygame。
      • 我帮你解决了。我从那个 URL 地址下载了那个文件并安装了它。
      • 你有 32 位 python 吗?
      【解决方案3】:

      你可能会在这个网站上找到http://www.pygame.org/download.shtml,只需搜索你想要的版本并安装它

      【讨论】:

      • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
      猜你喜欢
      • 2014-11-19
      • 2015-02-28
      相关资源
      最近更新 更多