【问题标题】:Cannot import sklearn_pandas in Google AI Platform Notebook after pip installpip install 后无法在 Google AI Platform Notebook 中导入 sklearn_pandas
【发布时间】:2019-10-12 11:04:37
【问题描述】:

我正在使用 Google 的 AI Platform Notebook(目前仍处于测试阶段)。我上传了一个依赖于 sklearn_pandas 的 python 脚本,我收到了这个错误:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-24f79569b871> in <module>
----> 1 from sklearn_pandas import DataFrameMapper

ImportError: No module named 'sklearn_pandas'

然后我尝试 pip 安装它:

!pip install sklearn-pandas

我重新启动了内核,但仍然出现相同的 ImportError。我这样做是为了确认确实安装了 sklearn pandas:

!pip list |grep -i sklearn

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
sklearn-pandas (1.8.0)

有人试过吗?在此之前我使用过google colab,我从来没有遇到过这样的困难。如果 Google colab 级别的用户体验可以移植到这个 beta 产品中,那就太好了。我认为这可能是一个一般的 python 模块导入问题,而不仅仅是 sklearn_pandas。

【问题讨论】:

    标签: google-cloud-platform jupyter-notebook sklearn-pandas gcp-ai-platform-notebook


    【解决方案1】:

    我觉得可能是

    %pip install sklearn-pandas
    

    而不是“!pip”。

    【讨论】:

    • 我在笔记本实例上确认了这一点,问题解决了。
    猜你喜欢
    • 2020-08-10
    • 2016-11-21
    • 2018-04-14
    • 1970-01-01
    • 2020-11-30
    • 2020-03-13
    • 1970-01-01
    • 2021-05-01
    • 2020-12-19
    相关资源
    最近更新 更多