Wie, um das Setup LIBSVM für Python

Baute ich libsvm auf Mac OS X mit Stellen.

$ tar xzfv libsvm-3.17.tar.gz
$ cd libsvm-3.17
$ make

Dieser baute die verschiedenen libsvm binaries:

$ 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

Ich auch mit diesem in /usr/local:

$ ls -la /usr/local/
...
svm -> /usr/local/libsvm-3.17/

Angehängt und die Python-bindings zu meinem Weg:

import sys
sys.path.append('/usr/local/svm/python')

Aber die Python-bindings nicht finden können, der "LIBSVM" - Bibliothek:

$ 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.

Kann mir jemand sagen, wie diese eingerichtet? In der python-readme für libsvm ist die einzige Beschreibung ist

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.

Was bin ich?

  • Anmerkung: statt kompilieren von Programmen selbst, die Sie möglicherweise verwenden möchten, ein Paket-manager wie die sehr gute MacPorts-manager: Paket-maintainer haben gelöst Zusammenstellung Probleme für Sie. 🙂
  • Ich hatte das gleiche problem unter einem 64bit Unix-Umgebung (64-bit-Python-installation). In meinem Fall versuche die 64bit von Liblinear das problem gelöst.
Schreibe einen Kommentar