如何安装启用Jupyter加载它的软件包?

时间:2018-02-19 13:50:30

标签: python jupyter-notebook

我已经安装了imageio

$ pip install imageio
Requirement already satisfied: imageio in /Library/Python/2.7/site-packages
Requirement already satisfied: numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from imageio)
Requirement already satisfied: pillow in /Library/Python/2.7/site-packages (from imageio)

现在我用Jupyter加载一个.ipynb文件:

$ jupyter notebook 1_notmnist.ipynb

得到错误:

ImportError: No module named imageio

我认为它与Can't load Python modules installed via pip from site-packages directory有关,并且完全按照答案的建议重新安装imageio

$ python -m pip install imageio

仍然没有帮助。

如何安装启用Jupyter加载它的imageio

更新

终端:$ which python

  

的/ usr /斌/蟒

Jupyter:

$ import sys
print sys.executable
  

/usr/local/opt/python/bin/python2.7

3 个答案:

答案 0 :(得分:2)

您可以通过jupter notebook安装模块,只需粘贴:

!pip install imageio

在你的笔记本中,它会起作用。

可能是你在python2上安装它并且它在jupyter上不可用,或者你正在使用虚拟环境。

答案 1 :(得分:0)

python2.7可能已经在PATH上,但如果没有,你可以

/usr/local/opt/python/bin/python2.7 -m pip install imageio 

或者您可以为系统的Python安装Jupyter内核

答案 2 :(得分:0)

当我在Jupyter Notebook和Mac OS中遇到类似的错误时,我在终端机中运行了以下命令:

sudo conda install imageio