Error when installing keras in anaconda. /p KERAS_BACKEND= 0<temp.txt

为君一笑 提交于 2019-12-29 08:53:09

问题


I was creating a new env in anaconda and after installing spyder, tensorflow and theano I attempted to install keras but I got an error message (see below). Now I cannot even open spyder as it stops working. Spyder only works if I uninstall keras again.

Do you have any idea what could be going on? I have another env in this same computer that works perfectly with the same packages installed.

(py36) C:\Users\LeicaMicroscope>conda install -c conda-forge keras
Solving environment: done

## Package Plan ##

  environment location: C:\Users\LeicaMicroscope\Anaconda3\envs\py36

  added / updated specs:
    - keras


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    certifi-2018.4.16          |           py36_0         143 KB  conda-forge

The following NEW packages will be INSTALLED:

    keras:           2.1.6-py36_0      conda-forge

The following packages will be UPDATED:

    ca-certificates: 2018.03.07-0                  --> 2018.4.16-0      conda-fo
rge
    certifi:         2018.4.16-py36_0              --> 2018.4.16-py36_0 conda-fo
rge
    openssl:         1.0.2o-h8ea7d77_0             --> 1.0.2o-vc14_0    conda-fo
rge [vc14]

Proceed ([y]/n)? y


Downloading and Extracting Packages
certifi-2018.4.16    |  143 KB | ###################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(py36) C:\Users\LeicaMicroscope>set "KERAS_BACKEND="

(py36) C:\Users\LeicaMicroscope>python C:\Users\LeicaMicroscope\Anaconda3\envs\p
y36\etc\keras\load_config.py  1>temp.txt

(py36) C:\Users\LeicaMicroscope>set /p KERAS_BACKEND= 0<temp.txt

(py36) C:\Users\LeicaMicroscope>del temp.txt

(py36) C:\Users\LeicaMicroscope>python -c "import keras"  1>nul 2>&1

(py36) C:\Users\LeicaMicroscope>if errorlevel 1 (
ver  1>nul
 set "KERAS_BACKEND=theano"
 python -c "import keras"  1>nul 2>&1
)

回答1:


It may sound really obvious, but did you try installing it with pip ?




回答2:


I've resolved this by uncommenting everything inside the keras_activate.bat and keras_deactivate.bat file of my conda environment. You can locate this under %HOME%\Anaconda3\envs\<env_name>\conda. Btw, I have my keras working with tensorflow backend by default.



来源:https://stackoverflow.com/questions/50806075/error-when-installing-keras-in-anaconda-p-keras-backend-0temp-txt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!