TensorFlow的Keras应用程序和预处理版本

Aba*_*ada 8 keras tensorflow

当我为TensorFlow安装*.whl时,我收到以下消息.我正在从源代码安装,如下所示:https://www.tensorflow.org/install/install_sources

keras 2.2.2 has requirement keras-applications==1.0.4, but you'll have keras-applications 1.0.5 which is incompatible.
keras 2.2.2 has requirement keras-preprocessing==1.0.2, but you'll have keras-preprocessing 1.0.3 which is incompatible.
Installing collected packages: keras-applications, keras-preprocessing, tensorflow
  Found existing installation: Keras-Applications 1.0.4
    Uninstalling Keras-Applications-1.0.4:
      Successfully uninstalled Keras-Applications-1.0.4
  Found existing installation: Keras-Preprocessing 1.0.2
    Uninstalling Keras-Preprocessing-1.0.2:
      Successfully uninstalled Keras-Preprocessing-1.0.2
Successfully installed keras-applications-1.0.5 keras-preprocessing-1.0.3 tensorflow-1.10.0
Run Code Online (Sandbox Code Playgroud)

你知道为什么安装会删除正确版本的Keras-Applications和Keras-Preprocessing,并重新安装更新的不兼容版本吗?

谢谢

jer*_*yin 2

看来您需要 Keras-2.1.6 而不是 Keras-2.2.2。所以,使用

sudo -H pip uninstall Keras

卸载当前的2.2.2版本,然后

sudo pip install Keras==2.1.6

希望这可以解决您遇到的问题。

对于出现这种情况的原因,我认为是因为TensorFlow需要Keras-Applications>=1.0.5, 和Keras-Preprocessing>=1.0.3。包管理算法始终与最新的可用包一起使用,这为我们带来了 Kera-2.2.2。而最新的 Keras 有一个奇怪的依赖关系要求,特别需要Keras-Applications==1.0.4, 和Keras-Preprocessing==1.0.2。我的解决方法是将 Keras 回滚到具有 >= 要求的稍旧版本,以使 pip 满意。

更进一步,我认为这要么是 Keras 2.2.2 依赖项中的一个错误,要么是故意的,因为 Keras 2.2.2 在某种程度上与最新的 Keras-Applications 或 Keras-Preprocessing 不兼容。