【问题标题】:Trouble installing pygame using pip install使用 pip install 安装 pygame 时遇到问题
【发布时间】:2015-06-15 10:30:16
【问题描述】:

我试过了: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, conte
nt-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 --allow-unverified,但这也给了我一个错误。

【问题讨论】:

  • 您必须使用来自bitbucket.org/pygame/pygame/downloads 的安装程序下载并安装它吗?
  • 不,不是真的,但是直接使用命令“pip install pygame”安装它也不会让我到任何地方。使用这种方法,我至少能够在它无法解压之前下载 80% 左右。我不太确定为什么它不起作用...

标签: python pygame shared-libraries pip


【解决方案1】:

这是唯一适合我的方法。

pip install pygame==1.9.1release --allow-external pygame --allow-unverified pygame

--

这些是引导我执行此命令的步骤(我将它们放在以便人们轻松找到它):

$ pip install pygame
Collecting pygame
  Could not find any downloads that satisfy the requirement pygame
  Some externally hosted files were ignored as access to them may be unreliable (use --allow-external pygame to allow).
  No distributions at all found for pygame

然后,根据建议,我允许外部:

$ pip install pygame --allow-external pygame
Collecting pygame
  Could not find any downloads that satisfy the requirement pygame
  Some insecure and unverifiable files were ignored (use --allow-unverified pygame to allow).
  No distributions at all found for pygame

所以我也允许无法验证:

$ pip install pygame --allow-external pygame --allow-unverified pygame
Collecting pygame
  pygame is potentially insecure and unverifiable.
  HTTP error 400 while getting http://www.pygame.org/../../ftp/pygame-1.6.2.tar.bz2 (from http://www.pygame.org/download.shtml)
  Could not install requirement pygame because of error 400 Client Error: Bad Request
  Could not install requirement pygame because of HTTP error 400 Client Error: Bad Request for URL http://www.pygame.org/../../ftp/pygame-1.6.2.tar.bz2 (from http://www.pygame.org/download.shtml)

所以,在访问了http://www.pygame.org/download.shtml之后,我想到了添加版本号(1.9.1release是目前稳定的版本)。

--

希望对你有帮助。

【讨论】:

  • 非常感谢您抽出宝贵的时间,我认为这可能有效,但我能够以不同的方式解决问题。
【解决方案2】:

如果您在安装 pygame 时遇到关于缺少 Visual Studio 10+ 的错误。我有答案: 问题不在于有没有 Visual Studio,因为我尝试了很多版本但它不起作用。问题是文件:在tar.gz.whl 之间 所以,这就是解决方案:

1) 下载文件:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

去这里下载你的 pygame 版本,注意 x64 或 x86 和 python 版本。我的系统是x64,python是3.4所以我选择:pygame-1.9.2a0-cp34-none-win_amd64.whl

2) 把它放在一些安装位置:

我把它放在“C:”中,所以打开 cmd: 并输入: cd C:\ (这是改变位置到 C:)

3) 安装

pip install C:\pygame-1.9.2a0-cp34-none-win_amd64.whl

完成!

【讨论】:

  • 对于任何阅读的人,请确保您在下载后不要更改文件名....否则将无法正常工作。
【解决方案3】:

我意识到兼容的 Pygame 版本只是损坏或损坏了。因此,我必须安装以前版本的 python 才能运行 Pygame。这实际上很好,因为大多数模块还没有更新为与 Python 3.4 兼容,所以它只给了我更多选择。

【讨论】:

    【解决方案4】:

    我自己遇到了这个错误(在使用 v3.10.0 时),然后我卸载了最新版本并安装了旧版本的 python(v3.9.7),它解决了这个问题。希望这也对你有用。老实说,除非它们从 python3 跳转到 python4,否则修复中没有太多变化。所以你不需要仅仅为了最新性而更新python

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-16
      • 2020-08-27
      • 2022-01-05
      • 2017-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多