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="