为了账号安全,请及时绑定邮箱和手机立即绑定

如何让 PySoundfile 在 Google Cloud Platform 柔性环境中运行?

如何让 PySoundfile 在 Google Cloud Platform 柔性环境中运行?

尚方宝剑之说 2021-11-02 09:49:38
我有一个简单的应用程序,我想将它部署到 GAE 标准或灵活的环境中,它需要生成简单的音频文件。我有使用PySoundfile在本地(在开发服务器上)运行良好的代码,但是libsndfile在部署应用程序时我遇到了底层错误。Traceback (most recent call last):  File "/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker    worker.init_process()  File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process    self.load_wsgi()  File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi    self.wsgi = self.app.wsgi()  File "/env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi    self.callable = self.load()  File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load    return self.load_wsgiapp()  File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp    return util.import_app(self.app_uri)  File "/env/local/lib/python2.7/site-packages/gunicorn/util.py", line 352, in import_app    __import__(module)  File "/home/vmagent/app/main.py", line 3, in <module>    import tonegen  File "/home/vmagent/app/tonegen.py", line 4, in <module>    import soundfile as sf  File "/env/local/lib/python2.7/site-packages/soundfile.py", line 267, in <module>    _snd = _ffi.dlopen('sndfile')  File "/env/local/lib/python2.7/site-packages/cffi/api.py", line 141, in dlopen    lib, function_cache = _make_ffi_library(self, name, flags)  File "/env/local/lib/python2.7/site-packages/cffi/api.py", line 802, in _make_ffi_library    backendlib = _load_backend_lib(backend, libname, flags)  File "/env/local/lib/python2.7/site-packages/cffi/api.py", line 797, in _load_backend_lib    raise OSError(msg)OSError: ctypes.util.find_library() did not manage to locate a library called 'sndfile'我也试过wave没有成功。
查看完整描述

1 回答

?
元芳怎么了

TA贡献1798条经验 获得超7个赞

在灵活的环境中,您可以尝试构建和使用自定义运行时,您可以在其中添加非 Python 依赖项,例如 OS 库(libsndfile在您的情况下以及您可能需要的任何其他内容)。

如何在 Google App Engine 柔性环境中配置 oracle jdk 中的答案基本相同。


查看完整回答
反对 回复 2021-11-02
  • 1 回答
  • 0 关注
  • 201 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信