from sklearn.neural_network import MLPClassifier,MLPRegressor Traceback (most recent call last): File "C:\Users\wyq_0\AppData\Local\Temp\ipykernel_13656\921061210.py", line 1, in <module> from sklearn.neural_network import MLPClassifier,MLPRegressor File "C:\Users\wyq_0\python\lib\site-packages\sklearn\neural_network\__init__.py", line 10, in <module> from ._multilayer_perceptron import MLPClassifier File "C:\Users\wyq_0\python\lib\site-packages\sklearn\neural_network\_multilayer_perceptron.py", line 26, in <module> from ..metrics import accuracy_score, r2_score File "C:\Users\wyq_0\python\lib\site-packages\sklearn\metrics\__init__.py", line 42, in <module> from . import cluster File "C:\Users\wyq_0\python\lib\site-packages\sklearn\metrics\cluster\__init__.py", line 22, in <module> from ._unsupervised import silhouette_samples File "C:\Users\wyq_0\python\lib\site-packages\sklearn\metrics\cluster\_unsupervised.py", line 16, in <module> from ..pairwise import pairwise_distances_chunked File "C:\Users\wyq_0\python\lib\site-packages\sklearn\metrics\pairwise.py", line 33, in <module> from ._pairwise_distances_reduction import ArgKmin File "C:\Users\wyq_0\python\lib\site-packages\sklearn\metrics\_pairwise_distances_reduction\__init__.py", line 89, in <module> from ._dispatcher import ( File "C:\Users\wyq_0\python\lib\site-packages\sklearn\metrics\_pairwise_distances_reduction\_dispatcher.py", line 11, in <module> from ._base import _sqeuclidean_row_norms32, _sqeuclidean_row_norms64 File "sklearn\metrics\_pairwise_distances_reduction\_base.pyx", line 1, in init sklearn.metrics._pairwise_distances_reduction._base AttributeError: module 'sklearn.utils._openmp_helpers' has no attribute '__pyx_capi__'咋办
时间: 2023-09-05 09:08:27 浏览: 188
这个错误可能是由于Scikit-learn与OpenMP的兼容性问题导致的。有一种可能的解决方法是禁用OpenMP,可以在代码中加入以下语句:
```
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
```
如果你使用的是Anaconda环境,也可以尝试卸载并重新安装Scikit-learn:
```
conda remove scikit-learn
conda install scikit-learn
```
如果以上方法都无法解决问题,建议升级你的编译器和OpenMP库,或者联系Scikit-learn官方社区获取更多帮助。
阅读全文