为什么我不能让 `pip install lxml` 在 raspberry pi 上的 virtualenv 中工作

Why can't I get `pip install lxml` to work within a virtualenv on raspberry pi

它一直冻结或给我

'arm-linux-gnueabihf-gcc': 错误。

一种选择是只使用 lxml 模块的打包版本。

如果你在 Python 3:

apt-get install python3-lxml

或 Python 2:

apt-get install python-lxml

如果您使用 --system-site-packages 创建 virtualenv,您将可以从 virtualenv 访问这个 lxml 安装。

我 运行 Raspbian 在我的 Pi 上伸展,看起来 pip install 获取二进制构建(因此不需要 gcc):

(venv) pi@lbb:~ $ pip install lxml
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting lxml
ww  Downloading https://www.piwheels.org/simple/lxml/lxml-4.2.1-cp35-cp35m-linux_armv7l.whl (4.9MB)
    100% |████████████████████████████████| 4.9MB 1.0MB/s 
Installing collected packages: lxml
Successfully installed lxml-4.2.1

你 运行 你的 Pi 上的发行版是一样的吗?如果不是,请更新您的问题以包含该信息。