conda 安装keras问题解决方法

1. 问题描述

>>>activate tensorflow
-----------------------------------------------------------------
conda.bat activate tensorflow
set "KERAS_BACKEND="
python D:\Anaconda3\envs\tensorflow\etc\keras\load_config.py  1>temp.txt
set /p KERAS_BACKEND= 0<temp.txt
del temp.txt
python -c "import keras"  1>nul 2>&1
if errorlevel 1 (
ver  1>nul
 set "KERAS_BACKEND=theano"
 python -c "import keras"  1>nul 2>&1
)

2. 解决方法

“在D:\Anaconda3\envs\tensorflow\etc\conda\”目录下找到“activate.d\keras_activate.bat”和 “deactivate.d\keras_deactivate.bat”文件,如下:

:: Figure out the default Keras backend by reading the config file.
python %CONDA_PREFIX%\etc\keras\load_config.py > temp.txt
set /p KERAS_BACKEND=<temp.txt
del temp.txt

:: Try to use the default Keras backend.
:: Fallback to Theano if it fails (Theano always works).
python -c "import keras" 1> nul 2>&1
if errorlevel 1 (
    ver > nul
    set "KERAS_BACKEND=theano"
    python -c "import keras" 1> nul 2>&1
)
set "KERAS_BACKEND="

把内容全部注释掉,搞定!

:: Figure out the default Keras backend by reading the config file.
::python %CONDA_PREFIX%\etc\keras\load_config.py > temp.txt
::set /p KERAS_BACKEND=<temp.txt
::del temp.txt

:: Try to use the default Keras backend.
:: Fallback to Theano if it fails (Theano always works).
::python -c "import keras" 1> nul 2>&1
::if errorlevel 1 (
    ::ver > nul
    ::set "KERAS_BACKEND=theano"
    ::python -c "import keras" 1> nul 2>&1
::)
::set "KERAS_BACKEND="
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容