如何解决无法正确安装Librosasndfile.dll没有名为“ sf_wchar_open”的属性
我正在尝试在Anaconda环境上安装librosa,我创建了一个全新的并安装的librosa,但是即使重新安装cffi软件包,audioread等,我仍然遇到此问题。我不确定如何解决此问题。
AttributeError Traceback (most recent call last)
<ipython-input-4-d10be33b41bf> in <module>
1 # load files with librosa as a series of floating points
----> 2 debussy,sr = librosa.load(debussy_file)
~\.conda\envs\librosa\lib\site-packages\librosa\core\audio.py in load(path,sr,mono,offset,duration,dtype,res_type)
144
145 try:
--> 146 with sf.soundFile(path) as sf_desc:
147 sr_native = sf_desc.samplerate
148 if offset:
~\.conda\envs\librosa\lib\site-packages\soundfile.py in __init__(self,file,mode,samplerate,channels,subtype,endian,format,closefd)
625 self._info = _create_info_struct(file,626 format,endian)
--> 627 self._file = self._open(file,mode_int,closefd)
628 if set(mode).issuperset('r+') and self.seekable():
629 # Move write position to 0 (like in Python file objects)
~\.conda\envs\librosa\lib\site-packages\soundfile.py in _open(self,closefd)
1168 if isinstance(file,_unicode):
1169 if _sys.platform == 'win32':
-> 1170 openfunction = _snd.sf_wchar_open
1171 else:
1172 file = file.encode(_sys.getfilesystemencoding())
AttributeError: cffi library 'C:\Users\User\.conda\envs\librosa\Library\bin\sndfile.dll' has no function,constant or global variable named 'sf_wchar_open'
解决方法
我不知道真正的解决方法,但是从soundfile.py
中删除该代码为我解决了。
只需删除第1170行的if
循环并将其修改为:
if isinstance(file,_unicode):
file = file.encode(_sys.getfilesystemencoding())
该错误不再发生。我正在寻找可以解释原因和方式的人,但现在,这个方法行之有效!
,conda-forge的libsndfile 1.0.29似乎已于2020年11月5日被破坏。在得到修复之前,GitHub上发布的“解决方案”是:1)使用pip安装librosa,或2)在conda中,删除libsndfile并从pip安装声音文件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。