- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
运行 Python 2.7 并尝试让绘图工作,教程推荐以下命令。
from matplotlib import pyplot as plt
从命令行运行时工作正常
python -c "from matplotlib import pyplot as plt"
但是当我尝试在 Jupyter Notebook 中运行它时出现错误。
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-21-1d1446f6fa64> in <module>()
----> 1 from matplotlib import pyplot as plt
/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py in <module>()
112
113 from matplotlib.backends import pylab_setup
--> 114 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
115
116 _IP_REGISTERED = None
/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.pyc in pylab_setup()
30 # imports. 0 means only perform absolute imports.
31 backend_mod = __import__(backend_name,
---> 32 globals(),locals(),[backend_name],0)
33
34 # Things we pull in from all backends
/usr/local/lib/python2.7/dist-packages/ipykernel/pylab/backend_inline.py in <module>()
154 configure_inline_support(ip, backend)
155
--> 156 _enable_matplotlib_integration()
/usr/local/lib/python2.7/dist-packages/ipykernel/pylab/backend_inline.py in _enable_matplotlib_integration()
152 backend = get_backend()
153 if ip and backend == 'module://%s' % __name__:
--> 154 configure_inline_support(ip, backend)
155
156 _enable_matplotlib_integration()
/usr/local/lib/python2.7/dist-packages/IPython/core/pylabtools.pyc in configure_inline_support(shell, backend)
359 except ImportError:
360 return
--> 361 from matplotlib import pyplot
362
363 cfg = InlineBackend.instance(parent=shell)
ImportError: cannot import name pyplot
下面的命令有效
import matplotlib
但是下面给了我一个类似的错误
import matplotlib.pyplot
最佳答案
您也可以使用 %matplotlib inline
魔法,但它之前必须有纯 %matplotlib
行:
作品(新窗口中的数字)
%matplotlib
import matplotlib.pyplot as plt
作品(内联数字)
%matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
不起作用
%matplotlib inline
import matplotlib.pyplot as plt
还有:Failure to import matplotlib.pyplot in jupyter (but not ipython)似乎是同一个问题。它看起来像是最近在 ipykernel 中引入的错误。也许有人将这个或其他问题标记为重复,谢谢。
关于python - 在 Jupyter Notebook 中导入 pyplot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38847900/
我不断收到以下消息:“自上次打开或保存笔记本文件以来,磁盘上的笔记本文件已更改。您想用此处打开的版本覆盖磁盘上的文件,还是加载磁盘上的版本(重新加载页面) )?”在 Jupyter 笔记本上,即使我没
让我们假设,我想打开一个笔记本(即使用我的本地 Jupyter 实例),但我不想用它启动关联的内核(即 Python)。我怎样才能做到这一点? 可能的用例: 我只想从以前的计算中获得笔记本输出。我不想
在将 IPython 笔记本转换为笔记本时,我试图隐藏一些特定的单元格。我想在类里面使用笔记本,并希望从包含问题和答案的主笔记本生成“练习”笔记本。 This post非常有帮助,但由于某种原因,使用
在过去的几个小时里,我一直在试图弄清楚如何将我的 Jupyter Notebook 下载为 pdf。我已经下载了 MiKTeX 并重新安装了 anaconda。下面的完整错误 500内部服务器错误 错
我想要一个完整的文件作为文本文件,而不仅仅是 IPython 笔记本中的一个单元格。 我在 IPython notebook 中写了一些代码,现在我想测试它们,所以我尝试将一些文本文件作为原始数据上传
我在我的办公室电脑上工作,由于安全限制不允许我安装程序(比如 miktex,....)。所以我决定将我的笔记本导出为 .html。 如您所见,渲染效果不佳: 一些代码被删减了 很多空间被破坏了,有很大
如何在终端中编辑我的 jupyter notebook。我只是不喜欢在网络浏览器中打开 jupyter notebook。我用谷歌搜索,但每个答案都与我们如何直接从终端打开笔记本有关。 最佳答案 我建
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 6年前关闭。 Improve thi
我正在使用 Julia,但并不是很喜欢 IDE(更像是一个笔记本电脑)。所以我第一次使用 Jupyter(实验室和笔记本)。 我从 Anaconda 启动了 Jupyter 并制作了我的笔记本。问题是
我试图用 ipython notebook 在终端中打开 ipython它不会打开 ipython notebook。它给出了以下错误: | ~/documents/ud120-projects/da
尝试从终端启动 jupyter notebook。我目前在正确文件夹中的终端上,并且安装了 python 3.5 和 conda。但它没有启动。 最佳答案 Jupyter Notebooks 允许您打
我有 plotly plotly 的 jupyter 笔记本不会保留 session 之间的 plotly 。 这是在基于官方 jupyter/datascience-notebook docker
我试过使用 pip3 install jupyter 安装 jupyter notebook。每次我启动一个新的 jupyter notebook 时,notebook 都无法连接到内核。请参阅下面的
我懂代码,懂 Markdown。 我已阅读 this Raw cells article ,但看不出太多。 什么是深奥的 NBConvert ? 请投点灯。 最佳答案 更新的文档位于 https://
运行代码后,我可以自动将笔记本保存为HTML。但是,有时结果生成速度太快,因此输出HTML在最后一个单元格中没有输出。 我想知道是否可以告诉文件进行自我保存? 就像是 # In last cell c
我在最近安装了 anaconda 的虚拟机中运行 Ubuntu 14.04。我使用 conda 安装了 jupyter 笔记本。我已经按照我可以在网上找到的所有文档来安装笔记本扩展,但它们无法加载并显
我正在使用 nbconvert通过命令行执行 iPython notebook(如 this answer ): ipython nbconvert --to=html --ExecutePrepro
除了原始 Jupyter Notebook 文件(.ipynb 文件)之外,有时我还会得到一个检查点 .ipynb 文件,该文件似乎直接链接到原始 。 ipynb 文件。 这些检查点文件的用途是什么?
我使用 ssh -L 连接到远程服务器,但如果我合上笔记本电脑盖子或连接丢失,jupyter 笔记本就会断开连接。 重新连接到远程服务器后,“最后一个” session 丢失。 如何才能使其持久?sc
Jupyter 笔记本支持 Markdown 单元格,但它似乎不支持表情符号代码。我想一种方法可能是使用 html 导入图标,如 fontawesome 有人有解决方法吗? 编辑:直接在 jupyte
我是一名优秀的程序员,十分优秀!