用port的话
sudo port install py26-scikit-learn
安装完执行
python -c "import sklearn; sklearn.test()"
结果就报错
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named sklearn
又是一个因为版本引起的悲剧
port select --list python
会有下面的结果:
Available versions for python:
none (active)
python25-apple
python26-apple
python27
python27-apple
sudo port select --set python python27
会提示
Selecting 'python27' for 'python' succeeded. 'python27' is now active.
port select --show python
结果
The currently selected version for 'python' is 'python27'.
sudo pip install nose
python -c "import sklearn; sklearn.test()"
安装成功
-c:1: UserWarning: sklearn.test() is no longer supported to run the
scikit-learn test suite.
After installation, you can launch the test suite from outside the
source directory (you will need to have nosetests installed)::
$ nosetests --exe sklearn
See the web page http://scikit-learn.org/stable/install.html#testing
for more information.
This function, `sklearn.test()` does not do anything. It does not run
the tests and will be removed in release 0.16.
围观我的Github Idea墙, 也许,你会遇到心仪的项目