在Ubuntu上安装Pygame时出错

时间:2016-05-01 15:15:05

标签: python python-3.x pygame install ubuntu-14.04

所以我一直在关注如何通过此链接安装Pygame的一些说明:http://programarcadegames.com/index.php?showpart=0#section_0.3

最后三个命令如下

$
# Use mercurial to clone current code
hg clone https://bitbucket.org/pygame/pygame

# Build and install
cd pygame
sudo python3 setup.py
$

当我运行最后一个命令来运行安装文件时,在运行正常之前我得到了这个错误。

building 'pygame.imageext' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT -DENABLE_NEWBUF=1 -I/usr/X11R6/include -I/usr/include/SDL -I/usr/include/SDL -I/usr/include -I/usr/include -I/usr/include/python2.7 -c src/imageext.c -o build/temp.linux-x86_64-2.7/src/imageext.o
In file included from src/pygame.h:32:0,
                 from src/imageext.c:49:
src/_pygame.h:80:20: fatal error: Python.h: No such file or directory
 #include <Python.h>
                    ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

关于我如何解决这个问题并完成我的Pygame安装的任何想法?

1 个答案:

答案 0 :(得分:2)

您需要安装python开发包,其中包括那些头文件。

sudo apt-get install python-dev