简体   繁体   English

ImportError:Keras 需要 TensorFlow 2.2 或更高版本。 通过 `pip install tensorflow` 安装 TensorFlow

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

How I can solve this problem?我该如何解决这个问题? I work on: Pycharm python 3.6 keras 2.4.3我工作:Pycharm python 3.6 keras 2.4.3

I try many times to install tensorflow but the install is failed in each time.我多次尝试安装 tensorflow 但每次安装都失败。

This error when I running: ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow我运行时出现此错误: ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow

This error when I try to install the tensorflow:当我尝试安装 tensorflow 时出现此错误:

在此处输入图像描述

You should do what it says, and run it from the command line.您应该按照它所说的去做,并从命令行运行它。 pip install tensorflow . pip install tensorflow But the problem is that you are not using the latest version of pip.但问题是您使用的不是最新版本的 pip。 Use python -m pip install –upgrade pip .使用python -m pip install –upgrade pip Then re-run everything.然后重新运行一切。 All from the command line.全部来自命令行。 And check that you are using the same python interpreter.并检查您是否使用相同的 python 解释器。

This is likely to do with how you have environments set up in Pycharm.这可能与您在 Pycharm 中设置环境的方式有关。 I would try what they are suggesting: try installing from the terminal (using the same environment).我会尝试他们的建议:尝试从终端安装(使用相同的环境)。 Better yet, create a new environment and install everything at the same time (ie Tensorflow, Keras)更好的是,创建一个新环境并同时安装所有内容(即 Tensorflow,Keras)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM