我正在尝试使用sidekit工具箱进行说话者识别,并且已经为Ubuntu安装了libsvm,而我正在使用anaconda 3.5。当我尝试导入sidekit时,出现以下导入错误

>>> 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时,我遇到了同样的问题。

1:如果要将Sidekit用于不涉及SVM(gmm-ubm,i-vector等)的系统,则可以通过编辑__init__.py而不导入libsvm来避免此问题。就您而言,它位于此处:
/home/shivam/anaconda3/lib/python3.5/site-packages/sidekit/__init__.py
在第140行上(在libsvm_loaded = False的正上方)添加if libsvm_loaded:,并且不会导入libsvm。

2:如果您希望能够制作基于SVM的系统(例如在示例脚本rsr2015_svm_gmm.py中),则Sidekit documentation会告诉您(在libsvm安装之后)将libsvm.so.2复制到.../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'))

请注意,如果要更新Sidekit,将替换__init__.py和。

关于python - 在Ubuntu上的python中导入Sidekit时出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42050356/

10-09 05:08