14

PythonでTwistedを使用したいのですが、インストールすると、このエラーが発生します。どのように処理しますか?

....
running build_ext
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c conftest.c -o conftest.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c conftest.c -o conftest.o
building 'twisted.runner.portmap' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c twisted/runner/portmap.c -o build/temp.linux-i686-2.7/twisted/runner/portmap.o
twisted/runner/portmap.c:10:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
4

1 に答える 1

38

拡張機能をコンパイルする必要があるパッケージをビルドするために必要なPython開発ヘッダーがありません。

OSXでビルドする場合は、ビルド済みのmac pythonパッケージをインストールするか、ソースからpythonをビルドする場合は、構成時にフレームワークフラグを使用してください。また、コンパイラがインストールされていることを確認してください。

Linuxでビルドしている場合は、おそらくpythondevelヘッダーをインストールする必要があります。たとえば、Ubuntuでは次のものが必要になります apt-get install build-essential python-dev。Python開発ヘッダーを取得したら、そのpythonインタープリターを使用してビルドすると、twistedがそれらを見つけることができるはずです。

于 2012-07-15T16:36:49.537 に答える