pycharm 导入错误:无法导入名称预处理

bnl4lu3b  于 2023-05-22  发布在  PyCharm
关注(0)|答案(2)|浏览(218)

从sklearn导入集成,模型选择,预处理。显示导入错误。(我正在使用Pycharm)

Traceback (most recent call last):
      File "File path", line 4, in <module>
        from sklearn import ensemble, model_selection, preprocesing, tree
    ImportError: cannot import name 'preprocesing'

我已经安装了NumPy, SciPy, and scikit-learn
目前,我的解释器是虚拟环境,我在某个地方阅读到我应该改变路径。我无法做到这一点',因为它说环境不空'任何帮助在这方面将高度赞赏

3j86kqsm

3j86kqsm1#

这是因为它们本身就是模块。尝试:

import sklearn.preprocessing
import sklearn.tree
import sklearn.ensemble

from sklearn.tree import DecisionTreeClassifier
jdgnovmf

jdgnovmf2#

这对我很有效

import sklearn.preprocessing as preprocessing
import sklearn.ensemble as ensemble
import sklearn.model_selection as ms

或者你可以像这样导入特定的类-

from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import GridSearchCV

相关问题