1. 程式人生 > >【TensorFlow】ImportError: cannot import name 'abs'

【TensorFlow】ImportError: cannot import name 'abs'

系統:

Windows、python3.6、Anaconda版本、CPU版本TensorFlow 1.12

有圖有真相:

報錯:

from tensorflow.python.keras._impl.keras.backend import abs
ImportError: cannot import name 'abs'

原因:

版本不匹配

解決辦法:

It seems to be a problem if there is a previous installation of tensorflow available. These steps seems to solve the problem.

1) uninstalling tensorflow 2) uninstalling protobuf 3) reinstalling tensorflow (which should come along with the correct protobuf version.

Also need to go to

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Lib\site-packages

and delete all tensorflow related folders