How do I install libsvm for python under windows 7?

Superdooperhero picture Superdooperhero · Oct 13, 2012 · Viewed 18.2k times · Source

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

Vinod Kumar Chauhan picture Vinod Kumar Chauhan · Sep 2, 2015

SOLVED:
1. Navigate to http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsvm
2. Download the .whl file of libsvm corresponding to your OS.
3. Open command prompt and navigate to that folder containing the downloaded .whl file.
4. Type the following command in command prompt-

pip install libsvm-3.20-cp27-none-win32.whl

NOTE: Type name of your .whl file after pip install