Quandl not working in Jupyter Notebook (but working at command-prompt)

爷,独闯天下 提交于 2019-12-24 21:22:38

问题


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

pip3 install quandl

And I am able to use various quandl methods.

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

No module named 'quandl'

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

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

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.


回答1:


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

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:

  • Go to Menu options / Kernel
  • Change kernel
  • <Select the kernel>

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)"

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).

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

Here's more info on IPython Kernels.



来源:https://stackoverflow.com/questions/58543374/quandl-not-working-in-jupyter-notebook-but-working-at-command-prompt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!