pip 安装后无法在 Google AI Platform Notebook 中导入 sklearn_pandas

Cannot import sklearn_pandas in Google AI Platform Notebook after pip install

我正在玩 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。

我觉得可能是

%pip install sklearn-pandas

而不是“!pip”。