我将使用Python分析数据以获取预测

-3 投票
2 回答
35 浏览
提问于 2025-04-14 16:34
from sklearn.model_selection import train_test_split
At line:1 char:1
+ from sklearn.model_selection import train_test_split
+ ~~~~
The 'from' keyword is not supported in this version of the language.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ReservedKeywordNotAllowed

这让我遇到了下面的错误

2 个回答

0

文件的名字应该像这样:data.py。此外,你的电脑上需要安装pip。推荐使用:安装了Python 3.7及以上版本的Vscode和pip。

  1. 创建一个名为data.py的文件
  2. 打开终端,运行 pip install scikit-learn
  3. 现在去那个文件里写代码
  4. 祝你编码愉快
1

要运行Python代码,你需要使用一个Python环境,比如Python解释器,或者一些集成开发环境(IDE),比如Visual Studio Code、PyCharm,或者如果你想逐行运行命令,可以用Jupyter Notebook。

撰写回答