我正在尝试在Google云端部署一个烧瓶应用程序。尽管遵循了他们的指示,但每当我启动dev服务器时,它都找不到给定vendor.add('lib')
的库。如何解决这个问题?
sudo /google-cloud-sdk/bin/dev_appserver.py app.yaml > file
INFO 2017-10-10 20:20:04,276 devappserver2.py:115] Skipping SDK update check.
INFO 2017-10-10 20:20:04,338 api_server.py:299] Starting API server at: http://localhost:53496
WARNING 2017-10-10 20:20:04,338 dispatcher.py:285] Your python27 micro version is below 2.7.12, our current production version.
INFO 2017-10-10 20:20:04,343 dispatcher.py:224] Starting module "default" running at: http://localhost:8080
INFO 2017-10-10 20:20:04,345 admin_server.py:116] Starting admin server at: http://localhost:8000
/deploy_10oct/lib
ERROR 2017-10-10 20:20:11,913 wsgi.py:263]
Traceback (most recent call last):
File "/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "deploy_10oct/main.py", line 11, in <module>
import h5py
ImportError: No module named h5py
INFO 2017-10-10 20:20:11,919 module.py:821] default: "GET / HTTP/1.1" 500 -
目录结构
ls
app.yaml
env
lame.pyc
main.pyc
templates
appengine_config.py
lib
requirements.txt
uploads
appengine_config.pyc
lame.py
main.py
static
答案 0 :(得分:1)
您需要在应用程序中创建一个lib
目录,并在该目录中安装依赖项(而不是在系统的python安装中)。来自Installing a third-party library:
创建一个目录来存储您的第三方库,例如
lib/
。mkdir lib
- 醇>
使用带有
-t <directory>
标志的pip(版本6或更高版本)将库复制到您之前创建的文件夹中 步。例如:pip install -t lib/ <library_name>