首页 > 代码库 > libsvm easy.py ValueError: need more than 0 values to unpack windows下终极解决

libsvm easy.py ValueError: need more than 0 values to unpack windows下终极解决

现象是:

python easy.py train test

输出:

Scaling training data...
WARNING: original #nonzeros 100389
new #nonzeros 9983948
Use -l 0 if many original feature values are zeros
Cross validation...
Traceback (most recent call last):
File "easy.py", line 61, in <module>
c,g,rate = map(float,last_line.split())
ValueError: need more than 0 values to unpack

 

grid.py 、 路径等均没有问题。

最后原因定位在:

cmd = ‘python {0} -svmtrain "{1}" -gnuplot "{2}" "{3}"‘.format(grid_py, svmtrain_exe, gnuplot_exe, scaled_file)
原因是grid.py被当成文本文件打开了,之前加上python字符就可以被视为python文件运行。 

 

via http://bbs.pinggu.org/forum.php?mod=viewthread&action=printable&tid=1529067

libsvm easy.py ValueError: need more than 0 values to unpack windows下终极解决