没有名为keras的模块 [英] No module named keras

查看:324
本文介绍了没有名为keras的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在/usr/local/lib/python3.5/dist-packages目录中经过很多努力之后,我已经成功安装了keras(默认情况下,已经在其中安装了).但是,每当我尝试导入或尝试修改keras后端时,它都会说没有名为keras的混淆.在这里,我在做什么错?在这些当前情况下,我将如何修改keras.json文件?

I have successfully installed keras after much struggle in the directory /usr/local/lib/python3.5/dist-packages(by deafult it has been installed there). But whenever i am trying to import or trying to modify the keras backend it says No mudule named keras. What am I doing wrong here and how will I modify the keras.json file in these current conditions?

推荐答案

我在做什么错了?

What am I doing wrong here?

问题是您启动了Python 2,但为Python 3安装了它.您的系统可能同时具有两个Python版本,但仅安装了一个版本.

The problem is that you start Python 2, but you installed it for Python 3. Your system has likely both Python versions, but you installed it only for one.

如果要启动Python 3,请尝试python3:

If you want to start Python 3, try python3:

python3 -c "from keras import backend; print(backend._BACKEND)"

如何修改keras.json文件?

How do I modify the keras.json file?

使用您选择的编辑器打开~/.keras/keras.json.例如:

Open ~/.keras/keras.json with the editor of your choice. For example:

nano ~/.keras/keras.json

这篇关于没有名为keras的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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