【问题标题】:Installing Theano and Keras on my Windows 10 Workstation在我的 Windows 10 工作站上安装 Theano 和 Keras
【发布时间】:2023-03-11 19:35:01
【问题描述】:

我正在尝试使用 Keras 在 Python 中开发神经网络,在成功安装在我的 Windows 10 Workstation Anaconda3(及其所有库:numpy、scikit-learn、pandas、SciPy 和 matplotlib)上之后,我意识到需要TensorFlow 或 Theano 也是如此。

在我安装 TensorFlow 失败后,我下载并能够安装 Theano,但尝试从 Python 提示符导入它,我收到以下信息:

WARNING: "g ++ not detected! Theano will be unable to execute optimized C implementations (for both CPU and GPU) and will default to Python implementations. Performance will be several degraded. To remove this warning, set Theano flags cxx to an empty string"

希望通过这种方式解决问题,我下载了 C++ Cygwin64 的 GNU 编译器,但没有任何改变!承认这确实是前进的正确方式,我应该如何访问“Theano flags cxx”?

【问题讨论】:

  • 您能解释一下您是如何安装 TensorFlow 和 Theano 的吗?
  • 关于 TensorFlow 我不记得了。为了安装 Theano,我打开了 CygWin64 终端并写了“pip install Theano”。一切都很好,在过程结束时......
  • 在使用 conda/Anaconda 时,一般应该使用conda install <package>,特别是对于编译了 C++ 库的 Theano 和 TensorFlow 等包。您应该从 Windows 命令提示符而不是 Cygwin 终端运行 conda install 命令(除非您在 Cygwin 中安装了 Anaconda)。确保在使用 conda 安装之前运行 pip uninstall Theano

标签: python cygwin anaconda theano keras


【解决方案1】:

首先,在没有 g++ 的情况下运行 theano 是唯一的性能问题。导入时它是一个警告,而不是例外。

但您可能希望在使用 keras 等深度学习库时获得性能,所以让我们尝试修复 theano 安装。

请关注theano docs 在 windows 上安装 theano。您可能需要清除以前安装的要求。

要安装 gcc,请按照 this section 说明:

Theano C 代码编译器当前需要安装 GCC。我们有 使用了为 32 位和 64 位提供的 build TDM GCC 平台...

按照安装说明从here下载。

张量流

我建议使用 tensorflow,因为 keras 最近将默认后端从 theano 更改为 tensorflow。

使用anacondapip 你应该很容易做到pip install tensorflow 并且它会起作用。

实际上,今天我刚刚使用 anaconda 在 Windows 10 上安装了 kerastensorflow,只需运行 pip install keras tensorflow,所以我建议您尝试全新安装 anaconda 和 python,然后再试一次。

如果您成功或在安装 theano / tensorflow / keras 时遇到其他问题,请更新

【讨论】:

  • 非常感谢!做你写的(但是以管理员权限启动 Anaconda 提示符!)我得到了以下结果:(1)成功安装了 protobuf-3.1.0.post1 tensorflow-0.12.1; (2) 成功搭建keras 安装收集包:theano, keras 成功安装keras-1.2.1 theano-0.8.2
  • 很好,如果问题仍未解决,请考虑批准答案或添加更多信息
猜你喜欢
  • 2016-03-09
  • 1970-01-01
  • 1970-01-01
  • 2017-08-23
  • 2017-03-23
  • 2012-05-03
  • 1970-01-01
  • 1970-01-01
  • 2017-03-17
相关资源
最近更新 更多