安装keras/theano时,遇到WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`警告的解决办法。
按照keras中文教程安装keras,安装过程结束后。
C:\Program Files\Anaconda3>python Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import keras Using Theano backend. WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain` 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
出现warning:g++ not available,后面提示用“conda install m2w64-toolchain”
然后我按照提示执行了conda install m2w64-toolchain
所需要的包安装完后,进入python,import keras
还是出现了这个错误
C:\Program Files\Anaconda3>python Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import keras Using Theano backend. WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain` 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.
从网上查找资料,说还要安装libpython,使用命令“conda install libpython”
按照以上步骤做完,到import keras时,还是出现了这个错误。
最后,看到有人使用“conda install mingw libpython”
C:\Program Files\Anaconda3>conda install mingw libpython Fetching package metadata ............. Solving package specifications: . Package plan for installation in environment C:\Program Files\Anaconda3: The following NEW packages will be INSTALLED: mingw: 4.7-1 Proceed ([y]/n)? y mingw-4.7-1.ta 100% |###############################| Time: 0:00:28 2.05 MB/s
执行完这个命令,还安装了一个包,看来真的是没装完。
再试试import keras真的可以了,没有错误了。
错误二:
在安装tensorflow时出现
Cannot remove entries from nonexistent file c:\program files\anaconda3\lib\site-packages\easy-install.pth
查看原因是因为setuptools版本太低,tensorflow要求29.0.1,当前版本为27.2.0,在更新setuptools版本的时候又找不到easy-install.pth,导致更新失败
运行:pip install –upgrade –ignore-installed setuptools,问题解决!