Quandl在Jupyter Notebook中不起作用(但在命令提示符下工作) [英] Quandl not working in Jupyter Notebook (but working at command-prompt)

查看:305
本文介绍了Quandl在Jupyter Notebook中不起作用(但在命令提示符下工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用命令在命令提示符处安装了quandl库:

I have already installed quandl library at command prompt using command:

pip3 install quandl

而且我可以使用各种quandl方法.

And I am able to use various quandl methods.

但是在我的Jupyter笔记本中,当我导入数量"时,它说:

But in my Jupyter Notebook, when I do "import quandl", it says:

No module named 'quandl'

我已经重新启动了Jupyter笔记本,即使结果相同.

I have restarted Jupyter notebook, even then the same results.

其他模块(例如Numpy,Pandas,Matplotlib)在命令提示符下以及Jupyter Notebook中对我来说都可以正常工作.

Other modules like Numpy, Pandas, Matplotlib work fine for me at the command-prompt and also in Jupyter Notebooks.

我已经看过其他提到相同问题的文章,但所有文章都只提到pip3 install命令-我已经从命令提示符处完成了此操作.

I have already gone through other posts mentioning the same issue, but all of them just mention the pip3 install command - which I have already done from command prompt.

推荐答案

之所以会这样,是因为活动的

This happens because the active env on your command line is not the same as your Jupyter Notebook's.

解决方案是使您的笔记本计算机与命令行活动的env使用相同的env.为此,您可以将Jupyter Notebook中的IPython内核更改为使用预期的env:

The solution is to make your Notebook use the same env as your command line's active env. You do that by changing the IPython Kernel in your Jupyter Notebook to one that uses the intended env:

  • 转到菜单选项/Kernel
  • Change kernel
  • <Select the kernel>
  • Go to Menu options / Kernel
  • Change kernel
  • <Select the kernel>

如果没有找到合适的内核,则需要创建一个新内核.为此,请从命令行(安装quandl的位置)运行以下命令:

If you don't see an appropriate kernel, you'll need to create a new one. To do that, from your command line (where you installed quandl), run this command:

python -m ipykernel install --user --name finance --display-name "Python (finance)"

这将创建一个名称为finance(存储在文件系统中)和显示名称为Python (finance)(如Jupyter Notebooks的内核"菜单中所示)的内核.

This creates a kernel with the name of finance (as stored in the file system) and the display name of Python (finance) (as shown on the Kernel menu in Jupyter Notebooks).

注意:您需要重新启动笔记本电脑(Menu / Kernel / Restart)中的内核才能看到新内核.

Note: you'll need to restart the kernel in your Notebook (Menu / Kernel / Restart) to see the new one.

有关 IPython内核.

这篇关于Quandl在Jupyter Notebook中不起作用(但在命令提示符下工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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