尽管安装了 helper,但在导入 helper 库时出错

Cap*_*ain 8 python-3.x google-colaboratory

我正在使用 colab 并且已经 !pip install helper ,但我面临错误 AttributeError: module 'helper' has no attribute 'imshow' 并且 AttributeError: module 'helper' has no attribute 'view_classify' helper 有什么问题?

sam*_*aya 8

要解决这些问题,请在笔记本最顶部的单元格中运行以下代码以安装帮助文件;

!wget -c https://raw.githubusercontent.com/udacity/deep-learning-v2-pytorch/master/intro-to-pytorch/helper.py
Run Code Online (Sandbox Code Playgroud)

然后重新启动笔记本的整个运行时以加载文件


And*_*w F 0

如果您收到AttributeError,则表明您安装了helper不同的版本。

您可以使用仅包含 pip 调用的块来开始 Colab 笔记本

!pip install helper==x.y.z
...
Run Code Online (Sandbox Code Playgroud)

每次启动新的运行时时都需要运行它。