问题描述:
Traceback (most recent call last):
File "C:/Users/Cjc/PycharmProjects/model/鸢尾花分类.py", line 4, in
import mglearn
File "C:\App\Anaconda3\envs\model\lib\site-packages\mglearn\__init__.py", line 1, in
from . import plots
File "C:\App\Anaconda3\envs\model\lib\site-packages\mglearn\plots.py", line 1, in
from .plot_linear_svc_regularization import plot_linear_svc_regularization
File "C:\App\Anaconda3\envs\model\lib\site-packages\mglearn\plot_linear_svc_regularization.py", line 3, in
from sklearn.svm import LinearSVC
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\svm\__init__.py", line 13, in
from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC, \
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\svm\classes.py", line 6, in
from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\linear_model\__init__.py", line 15, in
from .least_angle import (Lars, LassoLars, lars_path, LarsCV, LassoLarsCV,
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\linear_model\least_angle.py", line 25, in
from ..model_selection import check_cv
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\model_selection\__init__.py", line 1, in
from ._split import BaseCrossValidator
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\model_selection\_split.py", line 25, in
from scipy.misc import comb
ImportError: cannot import name 'comb'
Traceback (most recent call last):
File "C:/Users/Cjc/PycharmProjects/model/鸢尾花分类.py", line 4, in
import mglearn
File "C:\App\Anaconda3\envs\model\lib\site-packages\mglearn\__init__.py", line 1, in
from . import plots
File "C:\App\Anaconda3\envs\model\lib\site-packages\mglearn\plots.py", line 1, in
from .plot_linear_svc_regularization import plot_linear_svc_regularization
File "C:\App\Anaconda3\envs\model\lib\site-packages\mglearn\plot_linear_svc_regularization.py", line 3, in
from sklearn.svm import LinearSVC
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\svm\__init__.py", line 13, in
from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC, \
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\svm\classes.py", line 6, in
from ..linear_model.base import LinearClassifierMixin, SparseCoefMixin, \
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\linear_model\__init__.py", line 15, in
from .least_angle import (Lars, LassoLars, lars_path, LarsCV, LassoLarsCV,
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\linear_model\least_angle.py", line 25, in
from ..model_selection import check_cv
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\model_selection\__init__.py", line 1, in
from ._split import BaseCrossValidator
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\model_selection\_split.py", line 35, in
from ..gaussian_process.kernels import Kernel as GPKernel
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\gaussian_process\__init__.py", line 13, in
from .gpr import GaussianProcessRegressor
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\gaussian_process\gpr.py", line 15, in
from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\gaussian_process\kernels.py", line 30, in
from ..metrics.pairwise import pairwise_kernels
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\metrics\__init__.py", line 33, in
from . import cluster
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\metrics\cluster\__init__.py", line 8, in
from .supervised import adjusted_mutual_info_score
File "C:\App\Anaconda3\envs\model\lib\site-packages\sklearn\metrics\cluster\supervised.py", line 21, in
from scipy.misc import comb
ImportError: cannot import name 'comb'
解决方法:
修改lib\site-packages\sklearn\model_selection\_split.py
中from scipy.misc import comb
为from scipy.special import comb
修改lib\site-packages\sklearn\metrics\cluster\supervised.py
中from scipy.misc import comb
为from scipy.special import comb