unorderable types error when importing sklearn

扶醉桌前 提交于 2019-12-06 06:23:06

问题


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?


回答1:


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'

so your codes will be:

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)


来源:https://stackoverflow.com/questions/40824903/unorderable-types-error-when-importing-sklearn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!