Trouble installing pygame using pip install

2019-01-19 17:45发布

问题:

I tried: 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.

回答1:

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

--

Hope it helps.



回答2:

If you get trouble when install pygame error about missing 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. The problem is file: between tar.gz and .whl so, this is the solution:

1) Download file:

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

Go here and download your pygame version, notice about x64 or x86 and python version. My system is x64 and python is 3.4 so I choose: pygame-1.9.2a0-cp34-none-win_amd64.whl

2) Put it in some where to install:

I put it in "C:", so open cmd: and type: cd C:\ (this is change location to C:)

3) Install

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

Done !



回答3:

I realized that the compatible Pygame version was simply corrupted or broken. Therfore i had to install a previous version of python to run 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.