Superdooperhero Superdooperhero - 6 months ago 205
Python Question

How do I install libsvm for python under windows 7?

Would like to know how to install libsvm for python under windows 7?

I downloaded the livsvm zip, but I don't understand the instructions included. I have placed the libsvm.dll in my c:\windows\system32 directory, but when I try

import svmutil


or

from svm import *


I get

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "svmutil.py", line 3, in <module>
from svm import *
File "svm.py", line 16, in <module>
'../windows/libsvm.dll'))
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

Answer

I think there's no need to place the dll in the C:\windows\system32 directory unless you're using old versions of Windows (XP and older).

Make sure that:

  • You launch your python test script containing from svmutil import * inside the libsvm\python directory
  • You still have a copy of the libsvm dll in the libsvm\windows directory (if you moved it to C:\windows\system32, put a copy back in the libsvm\windows directory)

This works on my computer.

Comments