gpt4 book ai didi

python - 如何让 matplotlib 在 IPython 下工作?

转载 作者:太空宇宙 更新时间:2023-11-04 08:13:54 25 4
gpt4 key购买 nike

当我打字时

import matplotlib.pyplot as plt

在我的 IPython 笔记本中我得到

ImportError: No module named matplotlib.pyplot

默认情况下不应该安装这个模块吗?我需要额外安装它吗?如果是这样,我该怎么办。我在 Linux 上使用虚拟环境来安装东西(包括 IPython)。

最佳答案

默认不安装Matplotlib,IPython install page上有说明在 Linux 上安装:

Optionally install additional tools for scientific computing: On Ubuntu or other Debian-based distributions, type at the shell:

sudo apt-get install python-matplotlib python-scipy python-pandas python-sympy python-nose

On Fedora 18 and newer related distributions, use:

sudo yum install python-matplotlib scipy python-pandas sympy
python-nose

虽然如果您使用的是 python virtualenv,您应该能够在虚拟环境中使用 pip install matplotlib

关于python - 如何让 matplotlib 在 IPython 下工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17806391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com