Python sklearn包(可能)不兼容

时间:2016-11-29 19:00:18

标签: python packages

当我导入sklearn时,会发生此错误。我一直在很多地方寻找 关于如何解决它,但还没有找到解决方案。这个问题的原因是什么,你如何解决?

Traceback (most recent call last): File "<pyshell#19>", line 1, in <module> import sklearn File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\__init__.py", line 57, in <module> from .base import clone File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\base.py", line 12, in <module> from .utils.fixes import signature File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module> from .validation import (as_float_array, File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\validation.py", line 18, in <module> from ..utils.fixes import signature File "C:\Users\Brian\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\fixes.py", line 406, in <module> if np_version < (1, 12, 0): TypeError: unorderable types: str() < int()

这是我计算机中的软件包列表(操作系统:Windows 10):

cffi(1.9.1)
colorama(0.3.7)
密码学(1.6)
循环仪(0.10.0)
装饰者(4.0.10)
入口点(0.2.2)
idna(2.1)
变形(0.3.1)
ipykernel(4.5.1)
ipython(5.1.0)
ipython-genutils(0.1.0)
ipywidgets(5.2.2)
Jinja2(2.8)
jsonschema(2.5.1)
jupyter(1.0.0)
jupyter-client(4.4.0)
jupyter-console(5.0.0)
jupyter-core(4.2.0)
MarkupSafe(0.23)
matplotlib(2.0.0b4)
迷雾(0.7.3)
more-itertools(2.3)
mpmath(0.19)
nbconvert(4.2.0)
nbformat(4.1.0)
ndg-httpsclient(0.4.2)
鼻子(1.3.7)
笔记本(4.2.3)
numpy(1.12.0b1 + mkl)
opencv-python(3.1.0)
熊猫(0.3.1)
大熊猫(0.19.1)
pickleshare(0.7.4)
pip(9.0.1)
prompt-toolkit(1.0.9)
pyasn1(0.1.9)
pycparser(2.17)
Pygments(2.1.3)
pyOpenSSL(16.2.0)
pyparsing(2.1.10)
python-dateutil(2.6.0)
pytz(2016.7)
pyzmq(16.0.2)
qtconsole(4.2.1)
Quandl(3.0.1)
要求(2.12.1)
scikit-learn(0.18.1)
scipy(0.18.1)
setuptools(20.10.1)
simplegeneric(0.8.1)
六(1.10.0)
sklearn(0.0)
sklearn-contrib-lightning(0.4.0)
sympy(1.0)
龙卷风(4.4.2) traitlets(4.3.1)
wcwidth(0.1.7)
widgetsnbextension(1.2.6)
win-unicode-console(0.5)

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,并在此处找到了解决方案: https://github.com/scikit-learn/scikit-learn/issues/7898

基本上你必须打开文件C:\ Users \ Brian \ AppData \ Local \ Programs \ Python \ Python35 \ lib \ site-packages \ sklearn \ utils \ fixes.py并更改: np_version&lt; (1,12,0)到np_version [:2]&lt; (1,12)