在 Mac OSX 上安装 Scikit Learn

Installing Sci Kit Learn on Mac OSX

在我的 OSX 笔记本电脑上,我按照 this 页面上的说明将此命令 pip install -U numpy scipy scikit-learn 复制并粘贴到终端,从而安装了 Sci Kit Learn。

这是我在终端上再次 运行 命令时得到的结果:

Requirement already up-to-date: numpy in /usr/local/lib/python2.7/site- packages
Requirement already up-to-date: scipy in /usr/local/lib/python2.7/site-packages
Requirement already up-to-date: scikit-learn in /usr/local/lib/python2.7/site-packages
Cleaning up...

这是我在 Python 3.3.4 上 运行 from sklearn import datasets 时收到的错误消息。空闲:(我正在尝试 this 示例)

Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from sklearn import dataset
ImportError: No module named 'sklearn'

这里有什么问题?

您已经安装了 python 2.7 的软件包,如您在日志中所见

Requirement already up-to-date: numpy in /usr/local/lib/python2.7/site-packages

你是 运行 python 3.3.4.
因此,要么 运行 使用 python 2.7.x,要么安装 python3.x 的软件包。如何?检查 here