![](/img/trans.png)
[英]Librosa raised OSError('sndfile library not found') in Docker
[英]Error importing librosa for TensorFlow: sndfile library not found
我正在嘗試使用 TensorFlow Lite 進行使用 Jupyter 筆記本的語音識別項目,但是當我嘗試執行“導入 librosa”時(使用此處找到的命令: https://github.com/ShawnHymel/tflite-speech-recognition/blob /master/01-speech-commands-mfcc-extraction.ipynb )我不斷收到此錯誤:
OSError: sndfile library not found
我已經尋找了兩天的解決方案,嘗試了我在網上找到的許多不同的東西,但我似乎無法讓它工作。
我正在使用 CentOS 8 和 tensorflow 在 docker 上運行:
docker pull tensorflow/tensorflow:latest-py3-jupyter
docker run -it --rm -v /home/server/Desktop/TensorFlow -p 8888:8888 tensorflow/tensorflow:latest-py3-jupyter
我的 requirements.txt 是空的,至少在我執行pip freeze > requirements.txt時是這樣。
pip -V 或 --v 返回此
pip 20.3.2 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
嘗試安裝 pysndfile 給了我這個
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-w_gdqebo/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools 'numpy>=1.13.0' 'cython>=0.25.0' wheel Check the logs for full command output.
我嘗試了不同的命令來修復此錯誤並安裝 sndfile,但它們都給出了錯誤或只是說它已經安裝。
我確實安裝了 librosa,但嘗試導入它給了我這個完整的錯誤:
OSError Traceback (most recent call last)
<ipython-input-10-989066361697> in <module>
----> 1 import librosa
/usr/local/lib/python3.6/dist-packages/librosa/__init__.py in <module>
209 # And all the librosa sub-modules
210 from ._cache import cache
--> 211 from . import core
212 from . import beat
213 from . import decompose
/usr/local/lib/python3.6/dist-packages/librosa/core/__init__.py in <module>
4
5 from .convert import * # pylint: disable=wildcard-import
----> 6 from .audio import * # pylint: disable=wildcard-import
7 from .spectrum import * # pylint: disable=wildcard-import
8 from .pitch import * # pylint: disable=wildcard-import
/usr/local/lib/python3.6/dist-packages/librosa/core/audio.py in <module>
6 import warnings
7
----> 8 import soundfile as sf
9 import audioread
10 import numpy as np
/usr/local/lib/python3.6/dist-packages/soundfile.py in <module>
140 _libname = _find_library('sndfile')
141 if _libname is None:
--> 142 raise OSError('sndfile library not found')
143 _snd = _ffi.dlopen(_libname)
144 except OSError:
OSError: sndfile library not found
有人對如何排序有想法嗎?
為您的操作系統安裝 sndfile。 在 CentOS 上應該是yum install libsndfile
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.