无法在Windows中安装pygame模块

时间:2015-03-04 05:15:14

标签: python-2.7 pip

我正在尝试使用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.1发布运行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

2 个答案:

答案 0 :(得分:1)

首先,您必须安装piptry using this才能提供帮助。

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

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

答案 1 :(得分:1)

确保

c:\python27\scripts 

位于 PATH 环境变量中。