http://blog.csdn.net/lj695242104/article/details/39500039
1) Install Python and go directly to the official website
2) Run "cmd" and enter Python directly to see if Python is 32-bit or 64-bit
2.1 If Python is 32-bit, locate the dynamic-link library Libsvm.dll (size:156.5kb) in the WINDOWS folder under the Libsvm-3.16 folder and add it to the system directory, such as ' C:\WINDOWS\system32\ ' , you can use LIBSVM in Python
2.2 If Python is 64-bit, you need to compile the 64-bit dynamic link library libsvm.dll yourself first. Here's how:
In the Programs list, under Microsoft Visual Studio 2012/visual Studio Tools, open VS2012 x64 cross Toolscommand Prompt, note that you must be 64-bit command Prompt.
(At this point, you may encounter an error: "Error cannot determine the location of the VS Common Tools Folder", do not panic, I am win7 64-bit system, installed VS2012, solve The method of this problem is: in the computer environment variable, the variable path setting value: C:\Windows\System32)
Dos to LIBSVM folder libsvm-3.16
Input nmake-f Makefile.win Clean all
A 64-bit dynamic-link library will be generated under the Windows directory of libsvm-3.16 (SIZE:192KB). Copy the newly generated libsvm.dll to the system directory (for example, ' C:\WINDOWS\system32\ ').
3) Testing
Open Idle
>>>import OS
>>>os.chdir (' E:\Software\LIBSVM\libsvm-3.18\python ')
>>>from Svmutil Import *
>>> y, x = Svm_read_problem (' ... /heart_scale ')
>>> m = Svm_train (y[:200], x[:200], '-C 4 ')
>>> P_label, P_ACC, P_val = Svm_predict (y[200:], x[200:], m)
accuracy = 84.2857% (59/70) (classification)
Get...
reference:http://blog.csdn.net/lqhbupt/article/details/8599295
-
Top
-
0
Go Use of LIBSVM-3.18 in Python environment