Python 未检测到 theano g++
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36722975/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
theano g++ not detected
提问by rggir
I installed theano
but when I try to use it I got this error:
我安装了theano
但是当我尝试使用它时出现此错误:
WARNING (theano.configdefaults): 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 severely degraded.
警告(theano.configdefaults):未检测到 g++!Theano 将无法执行优化的 C 实现(对于 CPU 和 GPU),并将默认为 Python 实现。性能会严重下降。
I installed g++
, and put the correct path in the environment variables, so it is like theano
does not detect it.
我安装了g++
,并在环境变量中放置了正确的路径,所以它就像theano
没有检测到它。
Does anyone know how to solve the problem or which may be the cause?
有谁知道如何解决问题或可能是什么原因?
回答by Emiel
I had this occur on OS X after I updated XCode (through the App Store). Everything worked before the update, but after the update I had to start XCode and accept the license agreement. Then everything worked again.
更新 XCode(通过 App Store)后,我在 OS X 上发生了这种情况。更新前一切正常,但更新后我必须启动 XCode 并接受许可协议。然后一切又恢复了。
回答by tauseef_CuriousGuy
On Windows, you need to install mingw to support g++. Usually, it is advisable to use Anaconda distribution to install Python. Theano works with Python3.4 or older versions. You can use conda install
command to install mingw.
在 Windows 上,您需要安装 mingw 以支持 g++。通常,建议使用 Anaconda 发行版来安装 Python。Theano 适用于 Python3.4 或更旧的版本。您可以使用conda install
命令来安装 mingw。
回答by Alex Cronin
This is the error that I experienced in my mac running jupyter notebook with a python 3.5 kernal hope this helps someone, i am sure rggir is well sorted at this stage :)
这是我在运行带有 python 3.5 内核的 jupyter notebook 的 mac 中遇到的错误,希望这对某人有所帮助,我相信 rggir 在这个阶段已经很好地排序了:)
ErrorUsing Theano backend. WARNING (theano.configdefaults): 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 severely degraded. To remove this warning, set Theano flags cxx to an empty string.
使用 Theano 后端时出错。警告(theano.configdefaults):未检测到 g++!Theano 将无法执行优化的 C 实现(对于 CPU 和 GPU),并将默认为 Python 实现。性能会严重下降。要删除此警告,请将 Theano 标志 cxx 设置为空字符串。
Causeupdate of XCode (g++ compiler) without accepting terms and conditions, this was pointed out above thanks Emiel
原因而不接受条款和条件的XCode(克++编译器)的更新,这指出了上述感谢Emiel
Resolution:
解析度:
- type g++ --version in the mac terminal
- "Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo." is output as an error
- launch Xcode and accept terms and conditions
- return g++ --version in the terminal
- Something similar to the following will be returned to show that Xcode has been fully installed and g++ is now available to keras
- Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
- Apple LLVM version 8.0.0 (clang-800.0.42.1)
- Target: x86_64-apple-darwin15.6.0
- Thread model: posix
- InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
- Restart you machine… I am sure there are some more complicated steps that someone smarter than me can add here to make this faster
- Run the model.fit function of the keras application which should run faster now … win!
- 在 mac 终端中输入 g++ --version
- “同意 Xcode/iOS 许可证需要管理员权限,请通过 sudo 以 root 身份重新运行。” 作为错误输出
- 启动 Xcode 并接受条款和条件
- 在终端中返回 g++ --version
- 将返回类似于以下内容的内容,以表明 Xcode 已完全安装并且 g++ 现在可用于 keras
- 配置为:--prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
- Apple LLVM 版本 8.0.0 (clang-800.0.42.1)
- 目标:x86_64-apple-darwin15.6.0
- 线程模型:posix
- 安装目录:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
- 重新启动你的机器......我相信有一些比我更聪明的人可以在这里添加一些更复杂的步骤来加快速度
- 运行 keras 应用程序的 model.fit 函数,它现在应该运行得更快……赢了!
回答by secret_wang
I solved this probelm just now on Windows 10 with Anaconda3. First apply
我刚刚在 Windows 10 上用 Anaconda3 解决了这个问题。先申请
conda install mingw
in the command line.
在命令行中。
If one comes across this problem
如果遇到这个问题
CondaIOError: IO error: Missing write permissions in: C:\ProgramData\Anaconda3"
CondaIOError:IO 错误:缺少写入权限:C:\ProgramData\Anaconda3”
change the attribute in the safety tab of the folder in which you installed Anaconda; make sure user has write permissions to this folder.
更改安装 Anaconda 的文件夹的安全选项卡中的属性;确保用户对该文件夹有写权限。
回答by Yousef Essam
Run the following command in centos
在centos中运行以下命令
yum install gcc-c++
then it will work
然后它会工作