AttributeError: cffi 库 '(pyModulesPath)\_soundfile_data\libsndfile64bit.dll' 没有名为 'sf_wchar_open' 的函数、常量或全局变量

SF1*_*udy 5 python audio python-3.x librosa soundfile

当我尝试使用与 librosa 模块相关的任何内容时,出现错误:

Traceback (most recent call last):
  File "C:\Users\User1\Documents\test3.py", line 36, in <module>
    x, Fs = librosa.load(fn_mp3, sr=None)
  File "C:\Program Files\Python38\lib\site-packages\librosa\core\audio.py", line 129, in load
    with sf.SoundFile(path) as sf_desc:
  File "C:\Program Files\Python38\lib\site-packages\soundfile.py", line 629, in __init__
    self._file = self._open(file, mode_int, closefd)
  File "C:\Program Files\Python38\lib\site-packages\soundfile.py", line 1172, in _open
    openfunction = _snd.sf_wchar_open
AttributeError: cffi library 'C:\Program Files\Python38\lib\site-packages\_soundfile_data\libsndfile64bit.dll' has no function, constant or global variable named 'sf_wchar_open'
Run Code Online (Sandbox Code Playgroud)

在出现错误之前,我libsndfile64bit.dll在站点包中创建了一个名为_soundfile_data的文件夹,并libsndfile64bit.dll此处下载,然后将其添加到该文件夹​​中,然后我提供的错误弹出。我曾尝试在 SO 上搜索答案,但没有相关问题,我无法编辑,libsndfile64bit.dll因此我无能为力。我使用的是 Windows 操作系统 64x、Python 3.8 和 librosa 0.7.2。

小智 7

我尝试了@Maos Tamir 的回答,但没有用对我有用的
是:


1.- 打开 anaconda 提示
2.- 激活所需的 venv
如果最初与conda 一起安装:
3.- conda uninstall librosa
4.-pip uninstall
soundfile 5.- pip install librosa 6.-
关闭提示
7.- 如果使用 jupyter 重新启动内核笔记本


小智 0

在使用 Python 3.7.9 的 Windows 10 中也存在同样的问题。尝试手动下载适当的 Windows 滚轮,然后从https://github.com/bastibe/SoundFile/releases/tag/0.10.3post1手动安装