【发布时间】:2013-01-16 06:59:04
【问题描述】:
我正在尝试关注:
from bs4 import BeautifulSoup
得到了错误
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/admin/__init__.py", line 355, in post
exec(compiled_code, globals())
File "<string>", line 1, in <module>
ImportError: No module named bs4
如何将它与Google App Engine runtime 2.7 一起使用?
更新
我的项目结构看起来像
flask-appengine-template/
docs/
licenses/
src/
application/
static/
templates/
models.py
settings.py
urls.py
views.py
libs/
bs4/
app.yaml
src.py
我正在使用来自here 的这个模板
由于app.yaml 的父级是src,我添加了一个文件src.py 并在其中添加了两行。
我仍然看到同样的错误
ImportError: No module named bs4
但是,根据app.yaml,我的项目名称是flaskonappengine
请告诉我我到底做错了什么?
【问题讨论】:
-
您是否在应用文件夹中添加了
bs4模块? BeautifulSoup 不作为受支持的库包含在内。有必要将其与应用程序一起加载。 -
我是否可以对不属于 GAE 的任何其他库执行此操作?
-
GAE 仅支持 Pure Python Modules。 bs4 不是纯 bcos,它的某些部分是用 C 编写的。但是,它的旧版本是纯用 Python 编写的。所以,你只需下载 BeautifulSoup 3.2.1 然后从中提取 BeautifulSoup.py 文件。
标签: python google-app-engine beautifulsoup