[英]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:除了上述答案,还有两个方面需要考虑:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.