Jupyter找不到keras的模块 [英] Jupyter can't find keras' module

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

问题描述

我已经安装了Anaconda的Tensorflow和Keras(在Windows 10上),我创建了一个使用Python 3.5.2的环境(Anaconda中的原始版本是Python 3.6). 当我尝试执行import keras as ks时,得到ModuleNotFoundError: No module named 'keras'.

I have installed Tensorflow and Keras by Anaconda (on Windows 10), I have created an environment where I am using Python 3.5.2 (the original one in Anaconda was Python 3.6). When I try to execute import keras as ks, I get ModuleNotFoundError: No module named 'keras'.

我试图通过sys.path.append(C:\\Users\\ ... \\Anaconda3\\python.exe)

同时使用笔记本电脑和游戏机,但我仍然遇到相同的错误.

with both notebook and console, but I continue to get the same error.

我该如何解决这个问题?

How could I solve this issue?

推荐答案

请尝试以下操作:

在jupyter笔记本单元中运行这些命令:

Run these in the jupyter notebook cell:

import sys

sys.path

sys.executable

它可能不是指向您的虚拟环境,而是指向根目录

It may not be pointing to your virtual environment but to the root

解决方法是从虚拟环境内部安装jupyter笔记本

The fix is to install the jupyter notebook from inside your virtual environment

$ . your_env/bin/activate

(your_env)$ python -m pip install jupyter

现在您可以导入tensorflow或keras了

Now you can import tensorflow or keras

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

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