Google合作伙伴上未找到模块错误

时间:2018-02-12 07:14:48

标签: google-colaboratory

运行以下代码时出现奇怪的导入错误。

    ! pip install --user --upgrade git+https://github.com/broadinstitute/keras-resnet
    import keras
    import keras_resnet

基本上,我尝试在google collab上为keras_retinanet安装keras_resnet但是我收到了一个未找到的错误。输出低于。安装完成但导入失败。在本地测试它只能在Google Collaboratory上失败。

  Running setup.py install for keras-resnet ... - \ done
Successfully installed keras-resnet-0.0.8
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-25-4521fd3221d7> in <module>()
      2 #os.chdir('keras-retinanet')
      3 import keras
----> 4 import keras_resnet
      5 #from keras-retinanet.keras_retinanet.models.resnet import custom_objects
      6 #model = keras.models.load_model('/path/to/model.h5', custom_objects=custom_objects)

ModuleNotFoundError: No module named 'keras_resnet'

1 个答案:

答案 0 :(得分:0)

尝试放弃--user?这对我有用:

!pip install --upgrade git+https://github.com/broadinstitute/keras-resnet
import keras
import keras_resnet