错误“Keras 需要 TensorFlow 2.2 或更高版本" [英] Error "Keras requires TensorFlow 2.2 or higher"
问题描述
我刚刚安装了 Visual Studio 2019 和 Tensorflow,但我无法导入 Keras,因为我收到以下错误消息:
I just installed Visual Studio 2019 and Tensorflow, but I cannot import Keras because I get the following error message:
Keras 需要 TensorFlow 2.2 或更高版本.通过 pip install tensorflow
Keras requires TensorFlow 2.2 or higher. Install TensorFlow via
pip install tensorflow
问题是我别无选择,只能安装 Tensorflow 1.15,因为我有以下设置:
The problem is that I had no choice but to install Tensorflow 1.15, because I have the following setup:
- Visual Studio 2019
- Python 3.7
- CPU i7 920(没有 avs,只有 SSE)
- Windows 7 64 位操作系统
- 英伟达 GPU
- CUDA 10.1
我必须为该 Python 版本、我的 CPU 和名为tensorflow-1.15.0-cp37-cp37m-win_amd64"的 CUDA 版本下载并安装一个轮子.
I had to download and install a wheel for that Python version, my CPU, and that CUDA version named "tensorflow-1.15.0-cp37-cp37m-win_amd64".
Tensorflow 似乎可以工作(它检测我的 GPU 并打印hello world"消息),但问题在于 Visual Studio 安装了最新版本的 Keras.
Tensorflow seems to work (it detects my GPU and prints a "hello world" message) but the problem is that Visual Studio installs the newest version of Keras.
如何指定较旧的兼容版本,新版本兼容什么?
How can I specify an older, compatible version, and what is the newer version compatible?
推荐答案
我在上次 keras 版本中遇到了同样的问题,我记得是这样的():
I had the same issue caused by last keras release,what i remember did():
1-升级张量流:
pip install --user --upgrade tensorflow-gpu
(可能缺少一些包,直接pip安装)
(there might be some missing packages, just pip install them)
2-升级 Tensorboard
2-Upgrade Tensorboard
pip install --user --upgrade tensorboard
(可能缺少一些包,直接pip安装)
(there might be some missing packages, just pip install them)
3-降级 Keras
pip install keras==2.3.1
(适用于我的最新版本)
(latest version working for me)
4-降级 tensorflow-gpu
4-Downgrade tensorflow-gpu
pip install --user --upgrade tensorflow-gpu==1.14.0
(适用于我的最新版本)
(latest version working for me)
如果有效请告诉我!
蟒蛇 2020.02
Python 3.7
CPU i3 8100
CPU i3 8100
操作系统 Windows 10 64
OS Windows 10 64
英伟达 GPU GTX1050TI
Nvidia GPU GTX1050TI
CUDA 10.1
这篇关于错误“Keras 需要 TensorFlow 2.2 或更高版本"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!