简体   繁体   English

使用 pip install 安装 pygame 时遇到问题

[英]Trouble installing pygame using pip install

I tried: c:/python34/scripts/pip install http://bitbucket.org/pygame/pygame我试过: c:/python34/scripts/pip install http://bitbucket.org/pygame/pygame

and got this error:并收到此错误:

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

Please if anyone have any solutions please feel free to share them!如果有人有任何解决方案,请随时分享! I also tried pip install --allow-unverified , but that gave me an error as well.我也试过pip install --allow-unverified ,但这也给了我一个错误。

This is the only method that works for me. 这是唯一对我有用的方法。

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

-- -

These are the steps that lead me to this command (I put them so people finds it easily): 这些是导致我执行此命令的步骤(我放了它们以便人们容易找到):

$ 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

Then, as suggestes I allow external: 然后,建议,我允许外部:

$ 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

So I also allow unverifiable: 因此,我也允许无法验证的内容:

$ 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)

So, after a visit to http://www.pygame.org/download.shtml , I thought about adding the version number (1.9.1release is the currently stable one). 因此,在访问http://www.pygame.org/download.shtml之后 ,我想到了添加版本号(1.9.1release是当前稳定的版本)。

-- -

Hope it helps. 希望能帮助到你。

If you get trouble when install pygame error about missing visual studio 10+. 如果您在安装pygame时遇到麻烦,关于缺少Visual Studio 10+的错误。 I have the answer: The problem is not about have or not have visual studio, because I try many version but it not work. 我有答案:问题不是关于是否拥有Visual Studio,因为我尝试了很多版本,但是没有用。 The problem is file: between tar.gz and .whl so, this is the solution: 问题是文件:在tar.gz.whl之间,这是解决方案:

1) Download file: 1)下载文件:

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

Go here and download your pygame version, notice about x64 or x86 and python version. 转到此处下载pygame版本,注意有关x64或x86和python版本的信息。 My system is x64 and python is 3.4 so I choose: pygame-1.9.2a0-cp34-none-win_amd64.whl 我的系统是x64,python是3.4,所以我选择: pygame-1.9.2a0-cp34-none-win_amd64.whl

2) Put it in some where to install: 2)将其放在一些安装位置:

I put it in "C:", so open cmd: and type: cd C:\\ (this is change location to C:) 我将其放在“ C:”中,因此打开cmd:并键入:cd C:\\(这是将位置更改为C :)

3) Install 3)安装

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

Done ! 完成!

I realized that the compatible Pygame version was simply corrupted or broken. 我意识到兼容的Pygame版本只是损坏或损坏。 Therfore i had to install a previous version of python to run Pygame. 因此,我必须安装以前版本的python才能运行Pygame。 Which is actually fine as most modules aren't updated to be compatible with Python 3.4 yet so it only gives me more options. 实际上,这很好,因为大多数模块尚未更新为与Python 3.4兼容,因此它只为我提供了更多选择。

I myself got this error(while using v3.10.0) and then I uninstalled the latest version and installed older version of python(v3.9.7) and it fixed the issue.我自己遇到了这个错误(在使用 v3.10.0 时),然后我卸载了最新版本并安装了旧版本的 python(v3.9.7) 并解决了这个问题。 Hope that works for you too.希望这对你也有用。 Honestly there are not many changes in the fix unless they jump from python3 to python4.老实说,除非他们从 python3 跳转到 python4,否则修复程序中没有太多变化。 so you dont need to update the python just for the sake of latest-ality所以你不需要为了最新性而更新python

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

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