Python 如何将“keras”从 1.2.0 升级到 2.0.0?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51159010/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:46:21  来源:igfitidea点击:

How do I upgrade "keras" from 1.2.0 to 2.0.0?

pythonrkeras

提问by KaRJ XEN

I am running an image classifier but it keeps producing the error

我正在运行图像分类器,但它不断产生错误

Keras loaded from keras Python module v1.2.0, however version 2.0.0 is required. Please update the keras Python package. Error in py_call_impl(callable, dots$args, dots$keywords) : TypeError: init() got an unexpected keyword argument 'data_format'

Keras 从 keras Python 模块 v1.2.0 加载,但需要 2.0.0 版。请更新 keras Python 包。py_call_impl(callable, dots$args, dots$keywords) 中的错误:TypeError: init() 得到了一个意外的关键字参数“data_format”

I have tried to remove and re-install keras through using python command "pip install keras --upgrade"and also through R using "install.packages("keras")" but all in vain.

我试图通过使用 python 命令“pip install keras --upgrade”以及通过 R 使用“ install.packages(“keras”)”来删除和重新安装 keras,但都是徒劳的。

Some one please advise me on how to get past that. When I try to update keras from python, it gives; enter image description here

有人请告诉我如何克服这一点。当我尝试从 python 更新 keras 时,它给出了; 在此处输入图片说明

回答by Gautam Kumar

Try to uninstall the keras first:

先尝试卸载keras:

pip uninstall keras

then install it :

然后安装它:

pip install keras==version_number

回答by tamil

could you try mentioning the version number in the pip command

您可以尝试在 pip 命令中提及版本号吗

pip install Keras==2.0.0

回答by Vikas Gautam

I will suggest you to use python anaconda. you will get less errors and most of them can be easily solved.

我会建议你使用 python anaconda。你会得到更少的错误,其中大部分都可以轻松解决。

here by looking image that you shared, it looks like problem is with versions of bleach, html5lib and google-gax, reinstall these dependencies.

在这里通过查看您共享的图像,问题似乎出在漂白、html5lib 和 google-gax 版本上,请重新安装这些依赖项。

回答by KaRJ XEN

I guess the solution was just bits from all the answers suggested down. So in this, I'm putting it all together.

我想解决方案只是从所有建议的答案中提取出来的。因此,在此,我将所有内容放在一起。

I solved the problem by removing "Keras", "Keras-Applications" & "Keras-Preprocessing" from python as well as "Keras-2.1.6" from R.

我通过从 python 中删除“Keras”、“Keras-Applications”和“Keras-Preprocessing”以及从 R 中删除“Keras-2.1.6”解决了这个问题。

I then re-installed "Keras" by pip install Keras==2.0.0then re-installed "Keras" in R also.

然后我通过pip install Keras==2.0.0重新安装了“Keras”,然后也在 R 中重新安装了“Keras”。

Now it runs perfectly.

现在它运行完美。

Thanks, everyone for your contributions that threw light on the path to take!

谢谢,大家的贡献为我们的道路指明了方向!