Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
974 views
in Technique[技术] by (71.8m points)

python 3.x - ImportError: No module named 'keras'

So basically, I am fairly new to programming and using python. I am trying to build an ANN model for which I have to use Tensor flow, Theano and Keras library. I have Anaconda 4.4.1 with Python 3.5.2 on Windows 10 x64 and I have installed these libraries by following method.

  1. Create a new environment with Anaconda and Python 3.5: conda create -n tensorflow python=3.5 anaconda
  2. Activate the environment: activate tensorflow
  3. After this you can install Theano, TensorFlow and Keras: conda install theano, conda install mingw libpython, pip install tensorflow, pip install keras,
  4. Update the packages: conda update --all

All these packages are installed correctly and I have check them with conda list. However, when I am trying to import any of these 3 libraries (i.e. Tensor flow, Theano and Keras), it is giving me the following error:

Traceback (most recent call last):
File "<ipython-input-3-c74e2bd4ca71>", line 1, in <module>
import keras
ImportError: No module named 'keras'
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Hi I have an solution try this if you are using Anaconda-Navigator

go to Anaconda Environment and search keras package and then install.

install keras

enter image description here

after install just type import keras in shell its working.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...