2013-08-17 50 views
1

我在Debian 6python 2.7,我已經使用命令試圖scrapy(根據the doc)安裝時:錯誤安裝scrapy使用的PyPI

pip install Scrapy 

,並得到這個錯誤

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-x86_64-2.7/twisted/runner/portmap.o 

twisted/runner/portmap.c:10:20: error: Python.h: No such file or directory 

twisted/runner/portmap.c:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token 

twisted/runner/portmap.c:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token 

twisted/runner/portmap.c:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PortmapMethods' 

twisted/runner/portmap.c: In function 'initportmap': 

twisted/runner/portmap.c:55: warning: implicit declaration of function 'Py_InitModule' 

twisted/runner/portmap.c:55: error: 'PortmapMethods' undeclared (first use in this function) 

twisted/runner/portmap.c:55: error: (Each undeclared identifier is reported only once 

twisted/runner/portmap.c:55: error: for each function it appears in.) 

error: command 'gcc' failed with exit status 1 

---------------------------------------- 
Cleaning up... 
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/Twisted/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-FSl8pj-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/Twisted 
Storing complete log in /root/.pip/pip.log 

我認爲問題是安裝Twisted庫時,所以我試圖單獨安裝它使用:

pip install Twisted 

並得到相同的錯誤。

我該如何解決這個問題?

回答

6

twisted/runner/portmap.c:10:20: error: Python.h: No such file or directory

嘗試安裝python2.7-dev包。

+0

這爲我修正了第一個錯誤代碼1,但是我碰到了另一個安裝了'python-lxml'的解決方案。 – Mike