我用 Make 在 Mac OS X 上构建了libsvm 。
$ tar xzfv libsvm-3.17.tar.gz
$ cd libsvm-3.17
$ make
这构建了各种 libsvm 二进制文件:
$ ls
COPYRIGHT heart_scale svm-predict.c svm-train.c tools
FAQ.html java svm-scale svm.cpp windows
Makefile matlab svm-scale.c svm.def
Makefile.win python svm-toy svm.h
README svm-predict svm-train svm.o
我还链接到这个/usr/local
:
$ ls -la /usr/local/
...
svm -> /usr/local/libsvm-3.17/
并将 Python 绑定附加到我的路径:
import sys
sys.path.append('/usr/local/svm/python')
但是 Python 绑定找不到“LIBSVM”库:
$ python test.py
Traceback (most recent call last):
File "test.py", line 8, in <module>
import svmutil
File "/usr/local/svm/python/svmutil.py", line 5, in <module>
from svm import *
File "/usr/local/svm/python/svm.py", line 22, in <module>
raise Exception('LIBSVM library not found.')
Exception: LIBSVM library not found.
谁能告诉我如何设置?在 libsvm 的 python 自述文件中,唯一的描述是
Installation
============
On Unix systems, type
> make
The interface needs only LIBSVM shared library, which is generated by
the above command. We assume that the shared library is on the LIBSVM
main directory or in the system path.
我错过了什么?