Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unorderable types error when importing sklearn

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 Answers

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)
like image 193
Y.Wei Avatar answered Jul 07 '26 08:07

Y.Wei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!