kev*_*son 3 python heroku python-3.x
我有一个在 Heroku 上运行的 python flask 应用程序,它使用了soundfile库。添加soundfile到requirements.txtHeroku 后给了我这个错误:
raise OSError('sndfile library not found')
Run Code Online (Sandbox Code Playgroud)
我查了一下,读到我需要libsndfile1导入库。但是当我也将其添加到时requirements.txt,构建失败并出现错误:
找不到与 libsndfile1 匹配的发行版
是否有导入此包的解决方法,以便我可以soundfile在 Heroku 上使用?
libsndfile1不是 Python 库,因此您无法通过requirements.txt.
实现此功能的一种方法是将aptbuildpack与 Python buildpack 一起使用:
删除libsndfile1从您的requirements.txt
将您的应用程序配置为使用两个构建包:
heroku buildpacks:set heroku/python
heroku buildpacks:add --index 1 heroku-community/apt
heroku buildpacks
# Should show apt first, then python
Run Code Online (Sandbox Code Playgroud)添加Aptfile要安装的 Ubuntu 软件包列表:
libsndfile1
Run Code Online (Sandbox Code Playgroud)提交您的更改并推送部署。您应该apt首先看到安装的包,然后是常规的 Python 部署。
| 归档时间: |
|
| 查看次数: |
1677 次 |
| 最近记录: |