1、用pycharm查看一下scikit-learn包的版本,我是0.17.1会报错
2、cmd查看包的版本
conda list
3、在Anaconda Prompt里输入pip install -U scikit-learn更新不成功;
4、在Anaconda Prompt里输入conda update scikit-learn更新成功,运行程序发现还是报错
5、程序中不要直接使用sklearn.model_selection,改为如下代码即可:
# 导入包
from sklearn import model_selection
# 使用model_selection
X_train, X_test, y_train, y_test = model_selection.train_test_split(trans_S, label_S, test_size=0.33, random_state=42)
完美解决!
至于为啥这样就可以了,sorry 能用就好了啊~