要死了, pip install lxml 老是错误,求解答

2016-01-13 19:23:43 +08:00
 aliehuhu
gcc: 内部错误:已杀死 (程序 cc1)
请提交一份完整的错误报告。
具体步骤请参见 <http://bugzilla.redhat.com/bugzilla>。
Compile failed: command 'gcc' failed with exit status 1
cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInit2n9hsr8u.c -o tmp/xmlXPathInit2n9hsr8u.o
cc tmp/xmlXPathInit2n9hsr8u.o -L/usr/lib64 -lxml2 -o a.out
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/local/bin/python3.5 -c "import setuptools, tokenize;__file__='/tmp/pip-build-naxwm8_v/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-pm50syyl-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-naxwm8_v/lxml
[root@vps ~]# pip list
beautifulsoup4 (4.4.1)
pip (7.1.2)
setuptools (19.2)
wheel (0.26.0)
[root@vps ~]#
7524 次点击
所在节点    Python
24 条回复
shakespaces
2016-01-13 19:29:12 +08:00
install 一个 python-devel 包试试
zhangyi2099
2016-01-13 19:31:16 +08:00
我装 scrapy 的时候,装 lxml 的也碰到了一些问题,不过是 Python 2.7 在 Mac OS X 平台, http://www.jianshu.com/p/493dfff65197 ,仅供参考
sbmzhcn
2016-01-13 19:33:30 +08:00
windows 下安装它是不可能成功的。去网上找 windows 下编译好的 lxml
aliehuhu
2016-01-13 19:33:41 +08:00
@shakespaces 一样啊!
yum install gcc python-devel mysql-devel libffi-devel
yum install libxml2
yum install libxslt-devel libxml2-devel
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel
yum install readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
这些都执行了
ctrainr
2016-01-13 19:34:19 +08:00
内存太小,可以增大 swap 试试
aliehuhu
2016-01-13 19:34:31 +08:00
@sbmzhcn 是 centos 6(64) + Python 3.5.1
shakespaces
2016-01-13 19:35:26 +08:00
@aliehuhu 。。。。。那就不知道问题所在了,,,,看看别人怎么回答吧
eccstartup
2016-01-13 19:48:47 +08:00
为什么不是 `pip3 install lxml` ?
aliehuhu
2016-01-13 20:06:22 +08:00
@eccstartup 我执行 pip install beautifulsoup4 成功了
julyclyde
2016-01-13 20:55:32 +08:00
安装 python-lxml 需要 lxml-devel
但因为 pip 显示错误信息的方式比较奇怪,不太好确定你这个情况是不是因为缺 lxml-devel 导致的
20150517
2016-01-13 21:10:59 +08:00
lxml 一向很难装,特别 windows 上,装个编译过的 exe 就好了
tairan2006
2016-01-13 21:13:49 +08:00
libxml2-dev 是必须装的(ubuntu 下)
ericls
2016-01-13 23:39:46 +08:00
apt-get build-dep lxml 再 pip

也可能是内存不够 加个 swap 即可
9hills
2016-01-13 23:40:31 +08:00
装 libxml2
feather12315
2016-01-14 01:08:07 +08:00
找源码包, Python setup.py install ,看编译错误,装相应的包
feather12315
2016-01-14 01:09:00 +08:00
@20150517 没觉得难呀。囧,感觉比 scipy 好装多了
pynix
2016-01-14 07:22:35 +08:00
内存不够。。。
pynix
2016-01-14 07:23:26 +08:00
do512 上安装就出这类问题。
aliehuhu
2016-01-14 11:24:00 +08:00
@pynix @ctrainr 换了个 1G 内存的 vps ,成功了,哦也!
ctrainr
2016-01-14 12:27:19 +08:00
@aliehuhu 增大 swap 也行,我在 128 的机子上都编译过了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/250528

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX