简体   繁体   English

安装了错误的scikit-learn版本?

[英]Wrong scikit-learn version installed?

I encountered the same 我也遇到过

ValueError: scoring must return a number, got [...] (<class 'numpy.core.memmap.memmap'>) instead.

error as discussed in Q34857870 . Q34857870中讨论的错误

Based on answers to this question, and my own research, I believe this issue to be fixed in scikit-learn version 0.17.1, though I'm still encountering it. 根据对这个问题的回答以及我自己的研究,我相信这个问题将在scikit-learn版本0.17.1中修复,尽管我仍然遇到它。 Then I noticed something strange. 然后我注意到了一些奇怪的事情。

conda lists the right version. conda列出了正确的版本。

$ conda list scikit-learn packages in environment: scikit-learn 0.17.1 np111py27_0

My Jupyter notebook gives the right version: 我的Jupyter笔记本提供了正确的版本:

%load_ext watermark %watermark scikit-learn scikit-learn 0.17.1

But I get a different version when I check the version within my code: 但是当我检查代码中的版本时,会得到不同的版本:

import sklearn print(sklearn.__version__) 0.17

I wouldn't think anything of this, except I'm still seeing a bug in 0.17 that should have been fixed in 0.17.1, so I'm wondering whether I'm using the wrong version somehow. 我什么都不会想到,除了我仍然看到0.17中的一个错误,该错误应该已经在0.17.1中修复了,所以我想知道我是否以某种方式使用了错误的版本。

I'm wondering if it is somehow connected to Q30666685 . 我想知道它是否以某种方式连接到Q30666685

You probably have multiple versions of scikit learn installed. 您可能已安装了多个版本的scikit Learn。 You can see where it is installed by using 您可以使用查看安装位置

print(sklearn.__file__)

and then simply delete that. 然后将其删除。 In case if you are still having version troubles work within a virtual environment. 如果您仍然遇到版本问题,请在虚拟环境中进行工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM