anaconda prompt可以import,但jupyter notebook import失败的解决办法

首先在终端和jupyter里import sys,然后做下面的事情,看二者的结果是不是不一样。

摘自此链接:

Usually that indicates that the notebook is running with a different Python or in a different environment from Python in the command prompt. Check sys.executable to see which Python it's running in, and sys.path to see where it's looking for imports.

不一样的话按下面做的尝试:

1. 有时候是因为没有在环境中安装jupyter,单独安装一下:

conda install jupyter

或者

pip install jupyter

2. 有时候是jupyter还在原来的旧环境中运行,可以安装nb_conda_kernels包,就可以选择在哪个环境下运行。安装及使用参考这篇文章

3. 看到一篇主题相似的文章,mark一下:

关于在终端能到import模块 而在jupyter notebook无法导入的问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值