无法在 windows 中安装 pygame 模块

Not able to install pygame module in windows

我正在尝试使用 pip install pygame 安装 pygame 但它不起作用...

C:\Python27\pygame-1.9.1release>pip install pygame  
'pip' is not recognized as an internal or external command,operable program or batch file.  

我已经尝试 运行 来自 pygame-1.9.1release 的 setup.py 文件,但我得到了以下回溯...

No Arguments Given, Perform Default Install? [Y/n]y
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
building 'pygame._numericsurfarray' extension

Traceback (most recent call last):
File "C:\Python27\Lib\pygame-1.9.1release\setup.py", line 491, in <module>
setup(**PACKAGEDATA)
File "C:\Python27\lib\distutils\core.py", line 169, in setup
raise SystemExit, "error: " + str(msg)
SystemExit: error: Unable to find vcvarsall.bat

请指导我如何使用 pip 命令...以及如何安装 pygame

我正在使用 python2.7.8

在 python2.7.8 python shell 中尝试执行 get-pip.py 时,我得到以下回溯...

Traceback (most recent call last):
File "C:\Users\hardik\Downloads\get-pip(3).py", line 20204, in <module> main()  
File "C:\Users\hardik\Downloads\get-pip(3).py", line 152, in main bootstrap(tmpdir=tmpdir)  
File "C:\Users\hardik\Downloads\get-pip(3).py", line 130, in bootstrap sys.exit(pip.main(["install", "--upgrade"] + packages + args))  
File "c:\users\hardik\appdata\local\temp\tmpj_gcu3\pip.zip\pip\__init__.py", line 217, in main  
File "c:\users\hardik\appdata\local\temp\tmpj_gcu3\pip.zip\pip\basecommand.py", line 183, in main  
File "C:\Python27\lib\logging\config.py", line 776, in dictConfig dictConfigClass(config).configure()  
File "C:\Python27\lib\logging\config.py", line 575, in configure '%r: %s' % (name, e))  
ValueError: Unable to configure handler 'console': closed

你首先要安装piptry using this来帮忙。

下载文件get_pip.py,然后运行,然后您将成功安装pip

或者,查看 How do I install pip on Windows? 以获得更多帮助。

确保

c:\python27\scripts 

在你的PATH环境变量中。