cnn_utils 模块从 Google Colab 中丢失

cnn_utils module missing from Google Colab

我正在 Colab 中尝试从我的 Coursera class(在 Jupyter 中)运行 笔记本的副本,但出现错误:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-6-1ee14f68a167> in <module>()
      8 import tensorflow as tf
      9 from tensorflow.python.framework import ops
---> 10 from cnn_utils import *
     11 
     12 get_ipython().magic('matplotlib inline')

ModuleNotFoundError: No module named 'cnn_utils'

我试过 !pip install 但它又对我大喊:

Could not find a version that satisfies the requirement cnn_utils (from versions: )
No matching distribution found for cnn_utils

有人知道怎么解决吗?

cnn_utils这里只是课程的个人图书馆,不是public模块。您不能使用 pip install.

安装它

您需要找到 cnn_utils.py 的来源,然后将其下载到您的计算机,然后将其上传到 Colab。

这是来自 coursera 课程

cnn_utils.py