安装了keras在jupyter notebook上面运行却报错‘no module named keras’的解决办法

本地已经安装了keras的安装包,jupyter book在运行import keras时还是会报错:No module named 'keras'

解决方案有三种


1、Anaconda Navigator

在Anaconda Navigator中环境中添加jupyter和notebook。

2、添加tensorflow kernel

在Anaconda Prompt中操作:

(1)查看当前可用kernel:jupyter kernelspec list

(2)激活虚拟环境:activate tensorflow (注:tensorflow是之前创建的虚拟环境名)

(3)在tensorflow虚拟环境下,安装ipykernel:

conda install ipykernel

python -m ipykernel install --name tensorflow

删除kernel(如果不小心添加错了kernel,用此命令删除):

jupyter kernelspec remove env_name

(4)运行jupyter notebook:

jupyter notebook

(5)jupyter notebook页面切换kernel

   new—>tensorflow

3、在cmd中操作

(1)激活虚拟环境(注:tensorflow是之前创建的虚拟环境名):

activate tensorflow  

(2)安装nb_conda:

conda install nb_conda

(3)运行jupyter notebook:

jupter notebook


 

你可能感兴趣的:(深度学习,keras,jupyter,tensorflow)