简体   繁体   English

没有名为“tensorflow.contrib”的模块

[英]No module named 'tensorflow.contrib'

h5py
Keras==2.0.3
numpy
opencv-python
sklearn
tensorflow 2.0 > 

I'm getting the following error message我收到以下错误消息

Using TensorFlow backend.使用 TensorFlow 后端。 2020-04-02 01:53:58.259516: I 2020-04-02 01:53:58.259516:我
tensorflow/stream_executor/platform/default/dso_loader.cc:44]张量流/stream_executor/platform/default/dso_loader.cc:44]
Successfully opened dynamic library libcudart.so.10.1 Traceback (most成功打开动态库 libcudart.so.10.1 Traceback(大多数
recent call last): File "train_frcnn.py", line 10, in最近通话最后一次):文件“train_frcnn.py”,第 10 行,在
from keras import backend as K File "/usr/local/lib/python3.6/dist-从 keras 导入后端为 K 文件“/usr/local/lib/python3.6/dist-
packages/keras/ init .py", line 4, in包/keras/ init .py”,第 4 行,在

from .从 。 import applications File "/usr/local/lib/python3.6/dist-导入应用程序文件“/usr/local/lib/python3.6/dist-

packages/keras/applications/ init .py", line 1, in from .vgg16 import VGG16 File "/usr/local/lib/python3.6/dist-包/keras/applications/ init .py", line 1, in from .vgg16 import VGG16 File "/usr/local/lib/python3.6/dist-
packages/keras/applications/vgg16.py",包/keras/applications/vgg16.py",
line 14, in第 14 行,在
from ..models import Model File "/usr/local/lib/python3.6/dist-从 ..models 导入模型文件“/usr/local/lib/python3.6/dist-
packages/keras/models.py", line 14, in from . import layers as layer_module File "/usr/local/lib/python3.6/dist-包/keras/models.py", line 14, in from . import layers as layer_module File "/usr/local/lib/python3.6/dist-
packages/keras/layers/ init .py",包/keras/layers/ init .py",
line 4, in第 4 行,在
from ..engine import Layer File "/usr/local/lib/python3.6/dist-从 ..engine 导入层文件“/usr/local/lib/python3.6/dist-
packages/keras/engine/ init .py",包/keras/engine/ init .py",
line 8, in from .training import Model File "/usr/local/lib/python3.6/dist-第 8 行,在 from .training import Model File "/usr/local/lib/python3.6/dist-
packages/keras/engine/training.py", line 24, in from .. import callbacks as cbks File "/usr/local/lib/python3.6/dist-包/keras/engine/training.py", line 24, in from .. import callbacks as cbks File "/usr/local/lib/python3.6/dist-
packages/keras/callbacks.py", line 25, in from tensorflow.contrib.tensorboard.plugins import projector ModuleNotFoundError: No包/keras/callbacks.py”,第 25 行,来自 tensorflow.contrib.tensorboard.plugins 导入投影仪 ModuleNotFoundError:否
module named 'tensorflow.contrib'名为“tensorflow.contrib”的模块

keras-2.0.3 does not support tensorflow-2.x : keras-2.0.3不支持tensorflow-2.x

https://keras.io/#multi-backend-keras-and-tfkeras https://keras.io/#multi-backend-keras-and-tfkeras

The current release is Keras 2.3.0, which makes significant API changes and add support for TensorFlow 2.0.当前版本是 Keras 2.3.0,它对 API 进行了重大更改并添加了对 TensorFlow 2.0 的支持。

You must update your keras to 2.3.0 or higher (try python3.6 -m pip install --upgrade keras ).您必须将keras更新到2.3.0或更高版本(尝试python3.6 -m pip install --upgrade keras )。

In addition to the aforementioned answer, there are other two aspects to be taken into consideration:除了上述答案,还有两个方面需要考虑:

  1. 'tensorflow.contrib' has been removed from the packages. 'tensorflow.contrib' 已从包中删除。
  2. Use Keras inside TensorFlow as even Francois Chollet mentioned, since Keras version 2.3 is the last major release of Keras, there will be minor support after this release.在 TensorFlow 中使用Keras甚至 Francois Chollet 也提到过,由于 Keras 2.3 版是 Keras 的最后一个主要版本,因此在此版本之后会有少量支持。 Moreover, the Keras inside TensorFlow is more up-to-date and less prone to errors.此外,TensorFlow 中的 Keras 更加最新,更不容易出错。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有名为 tensorflow.contrib 的模块 - no module named tensorflow.contrib Tensorflow> ModuleNotFoundError:没有名为'tensorflow.contrib'的模块 - Tensorflow > ModuleNotFoundError: No module named 'tensorflow.contrib' ModuleNotFoundError:没有名为“tensorflow.contrib”的模块错误 - ModuleNotFoundError: No module named 'tensorflow.contrib' Error 错误:ModuleNotFoundError:没有名为“tensorflow.contrib”的模块 - Error: ModuleNotFoundError: No module named 'tensorflow.contrib' ModuleNotFoundError:没有名为“tensorflow.contrib”的模块,tensorflow=2.0.0 - ModuleNotFoundError: No module named 'tensorflow.contrib' with tensorflow=2.0.0 ModuleNotFoundError:没有名为“ tensorflow.contrib”的模块; 'tensorflow'不是包 - ModuleNotFoundError: No module named 'tensorflow.contrib'; 'tensorflow' is not a package ModuleNotFoundError:没有名为“tensorflow.contrib”的模块与 jupyter notebook - ModuleNotFoundError: No module named 'tensorflow.contrib' with jupyter notebook 我发现 ModuleNotFoundError: No module named 'tensorflow.contrib' - I found ModuleNotFoundError: No module named 'tensorflow.contrib' 如何修复:“ModuleNotFoundError: No module named 'tensorflow.contrib'” - How to fix: “ModuleNotFoundError: No module named 'tensorflow.contrib'” ModuleNotFoundError:制作聊天机器人时没有名为“tensorflow.contrib”的模块 - ModuleNotFoundError: No module named 'tensorflow.contrib' while making chatbot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM