Python 如何在带有dev_appserver.py的Google App Engine上使用带lxml的BeautifulSoup

Python 如何在带有dev_appserver.py的Google App Engine上使用带lxml的BeautifulSoup,python,google-app-engine,google-cloud-platform,beautifulsoup,lxml,Python,Google App Engine,Google Cloud Platform,Beautifulsoup,Lxml,我做了必要的步骤,可以从shell成功运行: pip install lxml -t lib cd lib python >>> from bs4 import BeautifulSoup >>> import lxml >>> res = BeautifulSoup("<p>hello</p>","lxml") >>> print res <html><body><p&

我做了必要的步骤,可以从shell成功运行:

pip install lxml -t lib
cd lib
python
>>> from bs4 import BeautifulSoup
>>> import lxml
>>> res = BeautifulSoup("<p>hello</p>","lxml")
>>> print res
<html><body><p>hello</p></body></html>
错误是:

Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

有什么问题吗?

lxml库是Python 2.7运行时的专用库,但默认情况下它不附带
dev_appserver.py
。您需要在计算机上单独安装它:

pip install lxml==2.3.5
请参阅的“将内置绑定库与本地开发服务器一起使用”一节

部署时,您需要将其添加到您的
app.yaml

libraries:
- name: lxml
  version: "2.3.5"

您是否安装了lxml<代码>pip安装lxml是的,我更新了问题。这是我尝试安装python lxml的一次尝试,它根本不存在
pip show lxml
给出了
版本:4.2.5
为什么要指定版本?App Engine只支持
2.3
2.3.5
3.7.3
,请参见上面的链接。
libraries:
- name: lxml
  version: "2.3.5"