无法运行keras [英] Cannot run keras
问题描述
我想在anaconda上运行keras,以便使用mnist手写识别进行卷积神经网络.在一切正常之前的一天,但是当我尝试运行相同的程序时,我在第一行中收到以下错误:
I want to run keras on anaconda for convolution neural network using mnist handwriting recognition. A day before everything worked fine but as I try to run the same program, i get the following error in the first line:
从keras.datasets导入mnist(代码的第一行)
from keras.datasets import mnist (first line of code)
ModuleNotFoundError:没有名为"keras.datasets"的模块; 'keras'不是 一个包装
ModuleNotFoundError: No module named 'keras.datasets'; 'keras' is not a package
我还创建了虚拟环境以使用python 3.5,因为我的python版本是3.6.我已经安装了keras和tensorflow.我该如何解决以上错误?也许这与路径有关,而不是与keras有关的错误.我的anaconda安装在E:whearas的工作环境是C:\ Users \ Prashant Mahato.
I also created virtual environment to use python 3.5 as my python version is 3.6. I have installed both keras and tensorflow. How do i fix the above error? Perhaps it is related to path and not error with keras. My anaconda is installed in E: whearas working environment is C:\Users\Prashant Mahato.
推荐答案
这是我安装Keras和其他相关依赖项的方式
Here is how I install Keras and other related dependencies
conda create -n <Environment_Name> python=3.6
activate <Environment_Name>
conda update --all
conda install mingw libpython
conda install scipy
conda install numpy
conda install mkl
conda install -c conda-forge tensorflow
conda install theano
pip install pyyaml
pip install h5py
pip install keras
conda install -c conda-forge tmux
conda install pandas
condas install pillow
conda install scikit-learn
conda install -c menpo opencv3
要检查一切是否正常,只需在创建的环境中将所有软件包导入python中即可.
To check if everything is work as it should just import all the packages in python within the environment created.
我正在运行Windows 10和Anaconda 4.2
I'm running Windows 10 and Anaconda 4.2
如果运行Ubuntu,请替换
If running Ubuntu, replace
activate <Environment_Name>
使用
source activate <Environment_Name>
HTH.
这篇关于无法运行keras的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!