見出し画像

ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`

stackoverflowからのコピペだが、とてつもなく重要な解決策なので保存の意味も込めて投稿します。わたしはこの解決策がなかったらたぶんAIを触ってない。

Then perform below steps:

Install anaconda win 64 with python 3.7 as one package
After Anaconda install, need to set the path C:\Users\username\Anaconda3\Scripts
update pip
Conda update


conda create -n tf20 python=3.7
pip install numpy
pip install "tensorflow>=1.15,<2.0"
pip install "tensorflow-gpu>=1.15,<2.0" (If GPU support needed)
pip install keras (installed with latest 2.4.2)
pip install --upgrade tensorflow-hub
pip install keras==2.2.4 (downgraded to 2.2.4)


Now keras running with tensorflow 1.15 Probably you can do pip install keras==2.2.4 in step 9 and remove step 11. Just try once above steps from step 2 onwards before uninstall everthing. If that works that you can save your time. Good Luck :)

-Thanks

この記事が気に入ったらサポートをしてみませんか?