问题描述
我想使用 sidekit 工具包进行说话者识别,并且我已经为Ubuntu安装了 libsvm ,我正在使用anaconda 3.5.当我尝试导入 sidekit 时,出现以下导入错误
I'm tyring to use sidekit toolkit for speaker recognition and I have installed libsvm for Ubuntu, I'm using anaconda 3.5. When I try to import sidekit I get following import error
>>> import sidekit
>>> import theano
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/shivam/anaconda3/lib/python3.5/site-packages/sidekit/__init__.py",
line 141, in <module>
from sidekit.libsvm import *
File "/home/shivam/anaconda3/lib/python3.5/site-packages/sidekit/libsvm/__init__.py",
line 37, in <module>
from sidekit.libsvm.svm import *
File "/home/shivam/anaconda3/lib/python3.5/site-packages/sidekit/libsvm/svm.py",
line 324, in <module>
fillprototype(libsvm.svm_get_sv_indices, None, [POINTER(svm_model), POINTER(c_int)])
File "/home/shivam/anaconda3/lib/python3.5/ctypes/__init__.py", line 360, in __getattr__
func = self.__getitem__(name)
File "/home/shivam/anaconda3/lib/python3.5/ctypes/__init__.py", line 365, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/libsvm.so.3: undefined symbol: svm_get_sv_indices
推荐答案
几个月前我安装Sidekit时遇到了同样的问题.
I had the same problem when I installed Sidekit some months ago.
1:如果要将Sidekit用于不涉及SVM(gmm-ubm,i-vector等)的系统,则可以通过编辑__init__.py
避免导入libsvm来避免此问题.就您而言,它位于此处:/home/shivam/anaconda3/lib/python3.5/site-packages/sidekit/__init__.py
.在第140行上(在if libsvm_loaded:
的正上方)添加libsvm_loaded = False
,并且不会导入libsvm.
1: If you want to use Sidekit for systems that do not involve SVMs (gmm-ubm, i-vectors etc.), then you can avoid the problem by editing __init__.py
to not import libsvm. In your case, it is located here:/home/shivam/anaconda3/lib/python3.5/site-packages/sidekit/__init__.py
.Add libsvm_loaded = False
on line 140 (right above if libsvm_loaded:
), and libsvm will not be imported.
2:如果您希望能够制作基于SVM的系统(例如在示例脚本rsr2015_svm_gmm.py
中),则可以使用Sidekit 文档告诉您(在libsvm安装之后)将libsvm.so.2
复制到.../python3.5/site-packages/sidekit/libsvm/
.
2: If you want to be able to make SVM-based systems (such as in the example script rsr2015_svm_gmm.py
), the Sidekit documentation tells you to (after libsvm installation) copy libsvm.so.2
into .../python3.5/site-packages/sidekit/libsvm/
.
如果import sidekit
仍然给出相同的错误,请检查.../python3.5/site-packages/sidekit/__init__.py
的第125行,并确保其显示libsvm = CDLL(os.path.join(dirname, 'libsvm.so.2'))
If import sidekit
still gives the same error, check line 125 of .../python3.5/site-packages/sidekit/__init__.py
and make sure it says libsvm = CDLL(os.path.join(dirname, 'libsvm.so.2'))
请注意,如果要更新Sidekit,将替换__init__.py
和.
Note that __init__.py
and will be replaced if you are to update Sidekit.
这篇关于在ubuntu上的python中导入sidekit时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!