是否可以在 Google App Engine 上使用 Python lxml?
我可以在 Google App Engine 上使用 Python lxml 吗? (或者我必须使用 Beautiful Soup 吗?)
我已经开始使用 Beautiful Soup 但看起来很慢。我刚刚开始尝试从其他网站“屏幕抓取”数据来创建某种“混搭”的想法。
Can I use Python lxml on Google App Engine? (or do I have to use Beautiful Soup?)
I have started using Beautiful Soup but it seems slow. I am just starting to play with the idea of "screen scraping" data from other websites to create some sort of "mash-up".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑:
lxml
库现已支持。简短回答:您不能。
来自 AppEngine 的文档:
“为Python环境编写的应用程序代码必须完全用Python编写。不支持用C语言编写的扩展”
现在您是否必须使用BeautifulSoup,这实际上取决于您打算如何使用它。请用详细信息更新问题,如果可能的话,我将尝试在此处更新其他建议。
EDIT: The
lxml
library is now supported.Short answer: you can't.
From AppEngine's docs:
"Application code written for the Python environment must be written exclusively in Python. Extensions written in the C language are not supported"
Now whether you must use BeautifulSoup or not, it really depends on how you plan to use it. Update the question with details and I'll try to update here with other suggestions, if possible.
要添加到 Caio 的修订答案,您可以使用
lxml
,具体操作方法如下:在
app.yaml
文件中,添加以下内容:现在
import lxml
将在您的 Python 脚本中运行。以下是官方文档的链接。
To add to Caio's revised answer, you can use
lxml
and this is how to do it:In your
app.yaml
file, add the following:Now
import lxml
will work in your Python script.Here is the link to the official documentation.