gpt4 book ai didi

python - 尝试导入 autosklearn 时 Colab 出错

转载 作者:行者123 更新时间:2023-12-02 19:02:54 25 4
gpt4 key购买 nike

我正在尝试在 Google Colab 中使用 Autosklearn,为此我已执行以下步骤:

!apt-get install build-essential swig 
!pip install auto-sklearn

当我尝试执行以下操作时,出现以下错误

import autosklearn

IncorrectPackageVersionError: found 'scikit-learn' version 0.22.2.post1 but requires scikit-learn version >=0.23.0

我尝试执行以下操作:

!pip install --upgrade scikit-learn

Requirement already up-to-date: scikit-learn in /usr/local/lib/python3.6/dist-packages (0.23.2)
Requirement already satisfied, skipping upgrade: threadpoolctl>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (2.1.0)
Requirement already satisfied, skipping upgrade: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.0.0)
Requirement already satisfied, skipping upgrade: scipy>=0.19.1 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.4.1)
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.19.4)
!pip install -U scikit-learn

Requirement already up-to-date: scikit-learn in /usr/local/lib/python3.6/dist-packages (0.23.2)
Requirement already satisfied, skipping upgrade: scipy>=0.19.1 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.4.1)
Requirement already satisfied, skipping upgrade: threadpoolctl>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (2.1.0)
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.19.4)
Requirement already satisfied, skipping upgrade: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.0.0)
!pip install scikit-learn==0.23.2

Requirement already satisfied: scikit-learn==0.23.2 in /usr/local/lib/python3.6/dist-packages (0.23.2)
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.23.2) (1.19.4)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.23.2) (1.0.0)
Requirement already satisfied: scipy>=0.19.1 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.23.2) (1.4.1)
Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.23.2) (2.1.0)

但是当我检查 sklearn 版本时,我看到以下内容:

import sklearn

print('The scikit-learn version is {}.'.format(sklearn.__version__))

The scikit-learn version is 0.22.2.post1.

当我尝试导入 autosklearn 时仍然收到错误

我还能如何安装/升级到 scikit-learn 版本 0.23.2(当前版本)?

最佳答案

此处的问题是,在您手动安装新版本(版本 0.23.2)之前,Colab 已在启动时导入 scikit-learn(版本 0.22.2.post1)。如果安装后重新启动运行时,将使用新版本。

关于python - 尝试导入 autosklearn 时 Colab 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65357589/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com