【问题标题】:Python: Matplotlib.pyplot works with jupyter notebook but doesnt work with VS Code .py scriptsPython:Matplotlib.pyplot 适用于 jupyter notebook 但不适用于 VS Code .py 脚本
【发布时间】:2019-07-20 11:22:02
【问题描述】:

最近我遇到了这个错误,import matplotlib.pyplot 在 jupyter notebook 中工作得很好,但是当我用相同的代码创建一个 test.py 并尝试在 VS Code 中运行它时,我得到了图片中显示的错误。我正在使用全新安装的 anaconda 4.6.7 和 python 3.7,并且我还在 jupyter 和 VSCode 上使用 conda 基础环境来运行我的脚本。

Jupyter Notebook

VSCode

【问题讨论】:

    标签: python-3.x matplotlib visual-studio-code jupyter-notebook


    【解决方案1】:

    我想通了,谢谢。我只需要在 power shell 中启用运行脚本,这解决了我的问题。不知道为什么这是一个问题。我是堆栈溢出的新手,我需要关闭或删除此问题,有人引导我走向正确的方向。

    【讨论】:

      猜你喜欢
      • 2018-02-01
      • 2020-10-22
      • 1970-01-01
      • 2016-09-03
      • 1970-01-01
      • 1970-01-01
      • 2022-01-26
      • 2017-06-20
      • 1970-01-01
      相关资源
      最近更新 更多