No module named keras

假装没事ソ 提交于 2019-12-23 04:32:51

问题


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?


回答1:


you should be able to edit keras.json directly. it should be at ~/.keras/keras.json .

also it seems you installed keras for python3 but are trying to use it with python(2). try using pip instead of pip3 (or python3 instead of python). :) see details here.




回答2:


What am I doing wrong here?

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.

If you want to start Python 3, try python3:

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

How do I modify the keras.json file?

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

nano ~/.keras/keras.json


来源:https://stackoverflow.com/questions/41369275/no-module-named-keras

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