导入sklearn时出现无序类型错误 [英] unorderable types error when importing sklearn
本文介绍了导入sklearn时出现无序类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Windows上安装了numpy(1.12.0b1),Scipy(0.18).我也安装了sci-kit.当我在python控制台中编写"import sklearn"时,出现如下错误: 如果np_version< (1、12、0): TypeError:不可排序的类型:str()< int() 会是什么问题?
I installed numpy(1.12.0b1), Scipy(0.18) on windows. I also installed sci-kit as well. When i wrote "import sklearn" in python console, it gives an error like this: if np_version < (1, 12, 0): TypeError: unorderable types: str() < int() What will be the issue?
推荐答案
问题出在版本号上,因此也许您可以尝试修改sklearn
文件夹中的fixs.py
.在第32行的try
之后添加这些脚本:
The problem is out on the version number, so maybe you could try to revise fixs.py
in the sklearn
folder. Add these script after the try
in line 32:
if not (x.isdigit()):
x='0'
因此您的代码将是:
def _parse_version(version_string):
version = []
for x in version_string.split('.'):
try:
if not (x.isdigit()):
x='0'
version.append(int(x))
#print(x)
except ValueError:
# x may be of the form dev-1ea1592
version.append(x)
return tuple(version)
这篇关于导入sklearn时出现无序类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文