Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Twisted in python failed with 'No such file'

I want use Twisted in Python, but when I installing ,in comes this error, how to handle it?

....
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
like image 868
zawdd Avatar asked Jul 15 '12 16:07

zawdd


1 Answers

You are missing the python development headers, needed to build packages that need to compile extensions.

If you are building on OSX, make sure you either install a prebuilt mac python package or if building python from source, use the framework flag when configuring. And also make sure you have XCODE installed so that you have a compiler.

If you are building on Linux, you probably need to install the python devel headers. For instance on Ubuntu you would need: apt-get install build-essential python-dev. Once you have the python development headers, twisted should be able to find them when you build with that python interpreter.

like image 50
jdi Avatar answered Nov 17 '22 20:11

jdi