我尝试使用sklearn,但得到错误湖:
| Error from sklearn.ensemble import RandomForestClassifier
| Error File "/Library/Python/2.7/site-packages/sklearn/ensemble/__init__.py", line 12, in <module>
| Error from .bagging import BaggingClassifier
| Error File "/Library/Python/2.7/site-packages/sklearn/ensemble/bagging.py", line 20, in <module>
| Error from ..linear_model import LogisticRegression
| Error File "/Library/Python/2.7/site-packages/sklearn/linear_model/__init__.py", line 23, in <module>
| Error from .ridge import (Ridge, RidgeCV, RidgeClassifier, RidgeClassifierCV,
| Error File "/Library/Python/2.7/site-packages/sklearn/linear_model/ridge.py", line 21, in <module>
| Error from .sag import sag_solver
| Error File "/Library/Python/2.7/site-packages/sklearn/linear_model/sag.py", line 14, in <module>
| Error from .sag_fast import sag, get_max_squared_sum
| Error ImportError: cannot import name get_max_squared_sum
我使用的是python2.7 mac OS。在github下载scikit-learn-master,然后运行sudo python setup.py install
我得到的清单太长了,所以我只放了一个我认为可能很重要的切片
blas_opt_info:
blas_mkl_info:
libraries mkl,vml,guide not found in ['/System/Library/Frameworks/Python.framework/Versions/2.7/lib', '/usr/local/lib', '/usr/lib', '/opt/local/lib']
NOT AVAILABLE
openblas_info:
libraries openblas not found in ['/System/Library/Frameworks/Python.framework/Versions/2.7/lib', '/usr/local/lib', '/usr/lib', '/opt/local/lib']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['/System/Library/Frameworks/Python.framework/Versions/2.7/lib', '/usr/local/lib', '/usr/lib', '/opt/local/lib']
NOT AVAILABLE
atlas_blas_info:
libraries f77blas,cblas,atlas not found in ['/System/Library/Frameworks/Python.framework/Versions/2.7/lib', '/usr/local/lib', '/usr/lib', '/opt/local/lib']
NOT AVAILABLE
FOUND:
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3)]
extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
running install
running build
答案 0 :(得分:0)
从文档中他们提到这些先决条件在安装scikit之前安装它们
Python (>= 2.6 or >= 3.3),
NumPy (>= 1.6.1),
SciPy (>= 0.9).
然后运行:
pip install -U scikit-learn