问题
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