首页 文章

Python 3 ImportError:无法导入名称'model selection' OS X 10.11.3,Anaconda

提问于
浏览
5

OS 3.5.1.3上的Python 3.5.1 | Anaconda 4.0.0(x86_64)

>>> from sklearn import pipeline, model_selection

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'model_selection'

试着:

升级六,sk-learn,

sudo pip uninstall python-dateutil
sudo pip install python-dateutil==2.2
pip2 install six -U
pip install --ignore-installed six
pip install --ignore-installed ipython

甚至重新安装anaconda ......没有修复 .

感谢帮助

_Updata

我已经检查过我的六个版本是最新版本( version = "1.10.0")

import sklearn sklearn.version'0.17.1'

我发现sklearn文件夹中没有文件夹名称"model_selection" . 但是https://github.com/scikit-learn/scikit-learn/tree/3078d7d611329c46777d4004a1185a3626558efe/sklearn中有这个文件夹 .

安装dev版本后

$ pip install git git://github.com/scikit-learn/scikit-learn.git

已成功安装scikit-learn-0.18.dev0

然后运行一个在0.17.1中成功运行的脚本,它显示错误:

来自.pairwise_fast import _chi2_kernel_fast,_sparse_manhattan ImportError:dlopen(/Users/Username/anaconda3/lib/python3.5/site-packages/sklearn/metrics/pairwise_fast.cpython-35m-darwin.so,2):未加载库:libmkl_intel_lp64 .dylib参考自:/Users/Username/anaconda3/lib/python3.5/site-packages/sklearn/metrics/pairwise_fast.cpython-35m-darwin.so原因:图片未找到

1 回答

  • 3

    您使用的是什么版本的scikit-learn?当我为Python 3.5安装时,看起来最新的是0.17.1 . 检查控制台:

    import sklearn
    sklearn.__version__
    '0.17.1'
    

    根据version的文档,"model_selection"包不存在 . 它确实存在于dev version中 . 这应该是它抱怨的原因 .

相关问题