在安装scikit-learn之前,已成功安装NumPy和SciPy(与Matplotlib和pandas一样多)
在此先感谢您的帮助:-)
这是问题的部分屏幕截图:
MacBook-Pro:~ $ python3.7 -m pip install scikit-learn --upgrade
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, ........
3.7/sklearn/tests
copying sklearn/tests/test_random_projection.py -> build/lib.macosx-10.9-x86_64-3.7/sklearn/tests
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/lj/dg6wx_g17x341nv6fs9z2znw0000gn/T/pip-install-b4ax1eex/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/lj/dg6wx_g17x341nv6fs9z2znw0000gn/T/pip-record-pvizldkz/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/lj/dg6wx_g17x341nv6fs9z2znw0000gn/T/pip-install-b4ax1eex/scikit-learn/
答案 0 :(得分:1)
您知道,问题似乎与Python 3.7本机模块有关:回滚到Python 3.6.5(卸载Python 3.7和安装Python 3.6.5),然后是NumPy,SciPy,Matplotlib,pandas,最后是scikit-learn正确安装。