如何在Python 2.7上安装PyGame(win 64)

时间:2015-12-29 14:26:41

标签: python windows python-2.7 pygame pip

我想在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)

还有一些像这样的错误。

2 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

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