python - 在 ubuntu 14.04 上安装 Scrapy 失败

标签 python ubuntu scrapy

我在我的 ubuntu 机器上安装 Scrapy 时遇到错误。我正在使用 pip 安装 Scrapy。我知道它需要安装 setuptools。我使用 setuptools 网站中提供的脚本安装了它。

reading manifest file 'Twisted.egg-info/SOURCES.txt'

writing manifest file 'Twisted.egg-info/SOURCES.txt'

creating build/lib.linux-x86_64-2.7/twisted/internet/iocpreactor/iocpsupport

copying twisted/internet/iocpreactor/iocpsupport/iocpsupport.c -> build/lib.linux-x86_64-2.7/twisted/internet/iocpreactor/iocpsupport

copying twisted/internet/iocpreactor/iocpsupport/winsock_pointers.c -> build/lib.linux-x86_64-2.7/twisted/internet/iocpreactor/iocpsupport

copying twisted/test/raiser.c -> build/lib.linux-x86_64-2.7/twisted/test

copying twisted/runner/portmap.c -> build/lib.linux-x86_64-2.7/twisted/runner

copying twisted/python/sendmsg.c -> build/lib.linux-x86_64-2.7/twisted/python

running build_ext

x86_64-linux-gnu-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

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/twisted

creating build/temp.linux-x86_64-2.7/twisted/runner

x86_64-linux-gnu-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: 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

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

知道流程哪里出了问题吗?我已经安装了 gcc 和 g++。

最佳答案

从错误 fatal error: Python.h: No such file or directory 看来 python 开发头文件没有安装。尝试此命令,然后再次尝试安装。

sudo apt-get install python-dev

要安装 libevent 库,请应用此命令,

sudo apt-get install libevent-dev

关于python - 在 ubuntu 14.04 上安装 Scrapy 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25216113/

相关文章:

linux - 如何以这种文件结构生成 DEBIAN/md5sums 文件?

python - Scrapy 在 POST 请求后无法检索数据

python - 验证scrapy项目代码

python - 从 Scrapy 的 RetryMiddleware 类继承时如何修复循环导入?

python - 如何从彩色图像创建 CMYK 半色调图像?

Python re.compile,将字符串分成两部分,同时保留分隔符

linux - 如何配置拇指安全性?

python - 高效地将列中的函数应用到其他列

python - 在不知道名称的情况下打印所有 POST 请求参数

GIT Pull 不通过 ssh 响应