ImportError: cannot import name ‘dtensor‘ from ‘tensorflow.compat.v2.experimental‘报错

1. Error analysis

The reason for this problem is that the versions of tensorflow and keras do not match. The version of keras is too high and needs to be reduced to the same version as tensorflow.

2. Solution steps

1. First check the keras version of your computer: pip show keras

In the picture above, my tensorflow version is 2.6, keras version is 2.12.0,

 2. Use pip install keras==2.6

 If there is an error message, it can be ignored, or pip install xxxx one by one:

tensorflow 2.6.0 requires clang~=5.0, which is not installed.
tensorflow 2.6.0 requires absl-py~=0.10, but you have absl-py 1.3.0 which is incompatible.
tensorflow 2.6.0 requires flatbuffers~=1.12, but you have flatbuffers 20210226132247 which is incompatible.

Guess you like

Origin blog.csdn.net/linxi4165/article/details/130463805