如何在 Windows 7(64 位)上安装 Pygame?我已经尝试了我能想到的一切,但没有任何效果。
我正在运行 CPython 2.7.3 32 位。
通过pip install pygame
from安装cmd
失败并出现错误(是的,我安装了 MinGW)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\users\r\appdata\local\temp\pip-build-R\pygame\setup.py", line 325, in
run
"mingw32: required environment variable"
RuntimeError: mingw32: required environment variable MINGW_ROOT_DIRECTORY not se
t
----------------------------------------
Command C:\Python27\python.exe -c "import setuptools;__file__='c:\\users\\r\\app
data\\local\\temp\\pip-build-R\\pygame\\setup.py';exec(compile(open(__file__).re
ad().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\r\appd
ata\local\temp\pip-vi1djm-record\install-record.txt --single-version-externally-
managed failed with error code 1 in c:\users\r\appdata\local\temp\pip-build-R\py
game
设置MINGW_ROOT_DIRECTORY=C:\MinGW
并重试后,我得到了错误
Downloading/unpacking pygame
Running setup.py egg_info for package pygame
WARNING, DLL for smpeg library not found.
WARNING, DLL for tiff library not found.
WARNING, DLL for SDL_ttf library not found.
WARNING, DLL for SDL_image library not found.
WARNING, DLL for vorbisfile library not found.
WARNING, DLL for jpeg library not found.
WARNING, DLL for vorbis library not found.
WARNING, DLL for SDL_mixer library not found.
WARNING, DLL for png library not found.
WARNING, DLL for SDL library not found.
WARNING, DLL for ogg library not found.
WARNING, DLL for z library not found.
WARNING, DLL for portmidi library not found.
warning: no files found matching 'readme.txt'
no previously-included directories found matching '*\CVS'
no previously-included directories found matching '*\*\CVS'
Installing collected packages: pygame
Running setup.py install for pygame
WARNING, DLL for smpeg library not found.
WARNING, DLL for tiff library not found.
WARNING, DLL for SDL_ttf library not found.
WARNING, DLL for SDL_image library not found.
WARNING, DLL for vorbisfile library not found.
WARNING, DLL for jpeg library not found.
WARNING, DLL for vorbis library not found.
WARNING, DLL for SDL_mixer library not found.
WARNING, DLL for png library not found.
WARNING, DLL for SDL library not found.
WARNING, DLL for ogg library not found.
WARNING, DLL for z library not found.
WARNING, DLL for portmidi library not found.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\r\appdata\local\temp\pip-build-R\pygame\setup.py", line 491
, in <module>
setup(**PACKAGEDATA)
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\distribute-0.6.38-py2.7.egg\setuptools
\command\install.py", line 53, in run
return _install.run(self)
File "C:\Python27\lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\users\r\appdata\local\temp\pip-build-R\pygame\setup.py", line 352
, in run
sys.version_info[:2])
RuntimeError: The dependencies are linked to the wrong C runtime for Python
2.7
Complete output from command C:\Python27\python.exe -c "import setuptools;__
file__='c:\\users\\r\\appdata\\local\\temp\\pip-build-R\\pygame\\setup.py';exec(
compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install
--record c:\users\r\appdata\local\temp\pip-xe1cpi-record\install-record.txt --s
ingle-version-externally-managed:
WARNING, DLL for smpeg library not found.
WARNING, DLL for tiff library not found.
WARNING, DLL for SDL_ttf library not found.
WARNING, DLL for SDL_image library not found.
WARNING, DLL for vorbisfile library not found.
WARNING, DLL for jpeg library not found.
WARNING, DLL for vorbis library not found.
WARNING, DLL for SDL_mixer library not found.
WARNING, DLL for png library not found.
WARNING, DLL for SDL library not found.
WARNING, DLL for ogg library not found.
WARNING, DLL for z library not found.
WARNING, DLL for portmidi library not found.
running install
running build
running build_py
running build_ext
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\r\appdata\local\temp\pip-build-R\pygame\setup.py", line 491, in
<module>
setup(**PACKAGEDATA)
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\distribute-0.6.38-py2.7.egg\setuptools\com
mand\install.py", line 53, in run
return _install.run(self)
File "C:\Python27\lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\users\r\appdata\local\temp\pip-build-R\pygame\setup.py", line 352, in
run
sys.version_info[:2])
RuntimeError: The dependencies are linked to the wrong C runtime for Python 2.7
----------------------------------------
Command C:\Python27\python.exe -c "import setuptools;__file__='c:\\users\\r\\app
data\\local\\temp\\pip-build-R\\pygame\\setup.py';exec(compile(open(__file__).re
ad().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\r\appd
ata\local\temp\pip-xe1cpi-record\install-record.txt --single-version-externally-
managed failed with error code 1 in c:\users\r\appdata\local\temp\pip-build-R\py
game
Storing complete log in C:\Users\R\pip\pip.log
二进制安装程序也不起作用。当我尝试运行安装程序时,菜单显示“来自其他位置的 Python - 整个功能将不可用”。如果我仍然继续,安装成功完成,但尝试导入 Pygame 仍然说没有这样的模块。我不确定它是否安装失败,或者它是否确实安装但没有正确更新路径,或者什么,但无论哪种方式它都不起作用。
我能做些什么?我无计可施。