Matplotlib 不适用于 Sublime 文本,但适用于 Jupiter Notebook
Matplotlib does not work with Sublime text, but does work with Jupiter Notebook
使用 Jupiter Notebook,我能够 运行 下面的代码来显示一个简单的图表。
import matplotlib.pyplot as plt
squares = [1, 4, 9, 16, 25]
plt.plot(squares)
plt.show()
现在我在 sublime text 中尝试了同样的方法,但它不起作用,我总是收到以下错误消息:
ModuleNotFoundError: No module named 'matplotlib'
我尝试使用以下代码更改 Python 构建系统,但没有成功。
{
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"shell": true
}
有谁知道我必须如何移动 matplotlib 库才能在 sublime text 中使用它?
提前致谢!
我通过删除 anaconda(和它的 matplotlib)并再次加载 anaconda 解决了我的问题。这可能有点奇怪,但它起作用了,我的简单代码示例现在可以起作用了。
为了删除 anaconda,我参考了以下手册:
使用 Jupiter Notebook,我能够 运行 下面的代码来显示一个简单的图表。
import matplotlib.pyplot as plt
squares = [1, 4, 9, 16, 25]
plt.plot(squares)
plt.show()
现在我在 sublime text 中尝试了同样的方法,但它不起作用,我总是收到以下错误消息:
ModuleNotFoundError: No module named 'matplotlib'
我尝试使用以下代码更改 Python 构建系统,但没有成功。
{
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"shell": true
}
有谁知道我必须如何移动 matplotlib 库才能在 sublime text 中使用它?
提前致谢!
我通过删除 anaconda(和它的 matplotlib)并再次加载 anaconda 解决了我的问题。这可能有点奇怪,但它起作用了,我的简单代码示例现在可以起作用了。
为了删除 anaconda,我参考了以下手册: