Keras打破了Anaconda提示 [英] Keras breaks Anaconda Prompt

查看:248
本文介绍了Keras打破了Anaconda提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Anaconda发行版上从tensorflow切换到了keras,后者遇到了一些问题.我通过Anaconda提示符使用命令安装它

I am switching from tensorflow to keras on my Anaconda distribution and am having some problems with the latter. I install it through Anaconda prompt with the command

conda install keras

由于运行命令,我认为安装未正确完成

and I do not think the installation is properly finished since it runs the command

python -c "import keras"  1>nul 2>&1

并关闭提示.此后,如果我要打开命令行,它将自动运行上面的命令并关闭它,因此我无法使用提示. Anaconda 5.3.1(Python 3.7)和Anaconda 5.2.0(Python 3.6)都发生了这种情况.

and closes the prompt. Afterwards, if I am to open the command line it automatically runs the command above and closes it, so I am unable to use the prompt. This has happened for both Anaconda 5.3.1 (Python 3.7) and Anaconda 5.2.0 (Python 3.6).

非常感谢您.任何帮助将不胜感激.

Thank you very much in advance. Any help will be much appreciated.

推荐答案

我将GAURAV和GYAN ARORA的答案合并后得出了答案.解决方案是这样的:

I figured out the answer after combining answers from GAURAV and GYAN ARORA. The solution is this:

1)转到%UserProfile%Anaconda3/etc/conda/activate.d并右键单击keras_activate.bat 2)点击编辑. .bat文件如下所示:

1) Go to %UserProfile%Anaconda3/etc/conda/activate.dand right click on keras_activate.bat 2) Click on edit. This is what the .bat file looks like:

:: 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
)

将两个1>nul都更改为1>.最终文件应如下所示:

Change both 1>nul to 1>. The final file should look like this:

:: 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> 2>&1
if errorlevel 1 (
    ver > nul
    set "KERAS_BACKEND=theano"
    python -c "import keras" 1> 2>&1
)

3)保存并关闭

这篇关于Keras打破了Anaconda提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆