Superdooperhero Superdooperhero - 8 months ago 287
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


from svm import *

I get

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


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.