树莓派无法安装lxml pip包

4

我正在尝试在安装了BeautifulSoup4包之后安装lxml包。

在终端中输入:

sudo pip install lxml

这是我得到的内容

sudo pip install lxml
Downloading/unpacking lxml
  Running setup.py egg_info for package lxml
    Building lxml version 3.6.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.26
    Building against libxml2/libxslt in the following directory: /usr/lib

Installing collected packages: lxml
  Running setup.py install for lxml
    Building lxml version 3.6.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.26
    Building against libxml2/libxslt in the following directory: /usr/lib
    building 'lxml.etree' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-armv9l-2.7/src/lxml/lxml.etree.o -w

然后它就在最后一行挂起了很长很长时间,我不得不通过按下CTRL+C来退出。

有人能告诉我这到底是什么意思吗?

然后我尝试使用pip freeze查看包是否安装。不,它不在那里。


这意味着你所使用的设备硬件相当有限,因此编译程序可能需要很长时间。如果在编译过程中退出,那么它没有被安装也就不足为奇了。 - Padraic Cunningham
在我的树莓派上,编译器崩溃并显示:“arm-linux-gnueabihf-gcc: internal compiler error: Killed (program cc1)”。可能是由于内存不足,我还不确定。 - Regis May
1个回答

11

你可以打开Python并尝试导入它。但如果是Python 3,请尝试以下操作:

sudo apt-get install python3-lxml

否则它就是

sudo apt-get install python-lxml

1
我的树莓派在使用 pip 安装 lxml 时会冻结,但使用 apt-get 安装后它可以正常工作了。非常感谢 :) - Parth Bhoiwala

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接