我试图在我的机器(macOS 10.13.4,Python 3.7.0)上安装scikit-learn无效。
我尝试了以下操作:
这些步骤都没有成功;相反,在运行安装命令后,我收到以下错误。
my_computer_hostname:~ my_user_folder$ pip3 install -U --force-reinstall scikit-learn
Collecting scikit-learn
Using cached https://files.pythonhosted.org/packages/f5/2c/5edf2488897cad4fb8c4ace86369833552615bf264460ae4ef6e1f258982/scikit-learn-0.19.1.tar.gz
Installing collected packages: scikit-learn
Running setup.py install for scikit-learn ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/hs/tvsnk51x3y925ntsyl3rbh2w0000gn/T/pip-install-x7yzme__/scikit-learn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/hs/tvsnk51x3y925ntsyl3rbh2w0000gn/T/pip-record-lorv9be_/install-record.txt --single-version-externally-managed --compile:
Partial import of sklearn during the build process.
blas_opt_info:
blas_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/Library/Frameworks/Python.framework/Versions/3.7/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
blis_info:
customize UnixCCompiler
libraries blis not found in ['/Library/Frameworks/Python.framework/Versions/3.7/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_info:
customize UnixCCompiler
customize UnixCCompiler
libraries openblas not found in ['/Library/Frameworks/Python.framework/Versions/3.7/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries tatlas not found in ['/Library/Frameworks/Python.framework/Versions/3.7/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_blas_info:
customize UnixCCompiler
libraries satlas not found in ['/Library/Frameworks/Python.framework/Versions/3.7/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries ptf77blas,ptcblas,atlas not found in ['/Library/Frameworks/Python.framework/Versions/3.7/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_blas_info:
customize UnixCCompiler
libraries f77blas,cblas,atlas not found in ['/Library/Frameworks/Python.framework/Versions/3.7/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
FOUND:
extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building library "libsvm-skl" sources
building extension "sklearn.__check_build._check_build" sources
building extension "sklearn.cluster._dbscan_inner" sources
… (Abridged for StackOverflow Char Limit) …
building extension "sklearn.utils._logistic_sigmoid" sources
building data_files sources
build_src: building npy-pkg config files
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/sklearn
copying sklearn/learning_curve.py -> build/lib.macosx-10.9-x86_64-3.7/sklearn
copying sklearn/multiclass.py -> build/lib.macosx-10.9-x86_64-3.7/sklearn
… (Abridged for StackOverflow Char Limit) …
copying sklearn/tests/test_kernel_approximation.py -> build/lib.macosx-10.9-x86_64-3.7/sklearn/tests
running build_clib
customize UnixCCompiler
customize UnixCCompiler using build_clib
building 'libsvm-skl' library
compiling C++ sources
C compiler: g++ -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/sklearn
creating build/temp.macosx-10.9-x86_64-3.7/sklearn/svm
creating build/temp.macosx-10.9-x86_64-3.7/sklearn/svm/src
creating build/temp.macosx-10.9-x86_64-3.7/sklearn/svm/src/libsvm
compile options: '-I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -c'
g++: sklearn/svm/src/libsvm/libsvm_template.cpp
ar: adding 1 object files to build/temp.macosx-10.9-x86_64-3.7/liblibsvm-skl.a
ranlib:@ build/temp.macosx-10.9-x86_64-3.7/liblibsvm-skl.a
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
building 'sklearn.__check_build._check_build' extension
compiling C sources
C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g
creating build/temp.macosx-10.9-x86_64-3.7/sklearn/__check_build
compile options: '-I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c'
gcc: sklearn/__check_build/_check_build.c
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.7/sklearn/__check_build/_check_build.o -Lbuild/temp.macosx-10.9-x86_64-3.7 -o build/lib.macosx-10.9-x86_64-3.7/sklearn/__check_build/_check_build.cpython-37m-darwin.so
building 'sklearn.cluster._dbscan_inner' extension
compiling C++ sources
C compiler: g++ -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g
creating build/temp.macosx-10.9-x86_64-3.7/sklearn/cluster
compile options: '-I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c'
g++: sklearn/cluster/_dbscan_inner.cpp
In file included from sklearn/cluster/_dbscan_inner.cpp:514:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1816:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
sklearn/cluster/_dbscan_inner.cpp:5960:21: error: no member named 'exc_type' in '_ts'
*type = tstate->exc_type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:5961:22: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:5962:19: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
sklearn/cluster/_dbscan_inner.cpp:5969:24: error: no member named 'exc_type' in '_ts'
tmp_type = tstate->exc_type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:5970:25: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:5971:22: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
sklearn/cluster/_dbscan_inner.cpp:5972:13: error: no member named 'exc_type' in '_ts'
tstate->exc_type = type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:5973:13: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:5974:13: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
sklearn/cluster/_dbscan_inner.cpp:6029:24: error: no member named 'exc_type' in '_ts'
tmp_type = tstate->exc_type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:6030:25: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:6031:22: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
sklearn/cluster/_dbscan_inner.cpp:6032:13: error: no member named 'exc_type' in '_ts'
tstate->exc_type = local_type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:6033:13: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:6034:13: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
1 warning and 15 errors generated.
In file included from sklearn/cluster/_dbscan_inner.cpp:514:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
In file included from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1816:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
sklearn/cluster/_dbscan_inner.cpp:5960:21: error: no member named 'exc_type' in '_ts'
*type = tstate->exc_type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:5961:22: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:5962:19: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
sklearn/cluster/_dbscan_inner.cpp:5969:24: error: no member named 'exc_type' in '_ts'
tmp_type = tstate->exc_type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:5970:25: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:5971:22: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
sklearn/cluster/_dbscan_inner.cpp:5972:13: error: no member named 'exc_type' in '_ts'
tstate->exc_type = type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:5973:13: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:5974:13: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
sklearn/cluster/_dbscan_inner.cpp:6029:24: error: no member named 'exc_type' in '_ts'
tmp_type = tstate->exc_type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:6030:25: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:6031:22: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
sklearn/cluster/_dbscan_inner.cpp:6032:13: error: no member named 'exc_type' in '_ts'
tstate->exc_type = local_type;
~~~~~~ ^
sklearn/cluster/_dbscan_inner.cpp:6033:13: error: no member named 'exc_value' in '_ts'; did you mean 'curexc_value'?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
sklearn/cluster/_dbscan_inner.cpp:6034:13: error: no member named 'exc_traceback' in '_ts'; did you mean 'curexc_traceback'?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
1 warning and 15 errors generated.
error: Command "g++ -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c sklearn/cluster/_dbscan_inner.cpp -o build/temp.macosx-10.9-x86_64-3.7/sklearn/cluster/_dbscan_inner.o -MMD -MF build/temp.macosx-10.9-x86_64-3.7/sklearn/cluster/_dbscan_inner.o.d" failed with exit status 1
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/hs/tvsnk51x3y925ntsyl3rbh2w0000gn/T/pip-install-x7yzme__/scikit-learn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/hs/tvsnk51x3y925ntsyl3rbh2w0000gn/T/pip-record-lorv9be_/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hs/tvsnk51x3y925ntsyl3rbh2w0000gn/T/pip-install-x7yzme__/scikit-learn/
据我所知,似乎我缺少一个额外的依赖项。关于可能的想法或可以安装的其他建议?
谢谢您的帮助!