python - VSCode - 在调试时显示图像

标签 python visual-studio-code

我目前正在使用 visual studio code 来调试 python 文件。在那个 python 文件中是一个 numpy 图像。当我尝试导入 matplotlib 来显示图像时,它没有显示:

- plt.imshow(pred_scores)
<matplotlib.image.AxesImage object at 0x7f3d43e691d0>
- plt.show()
None
- pred_scores
array([[0., 0., 0., ..., 0., 0., 0.],
       [0., 0., 0., ..., 0., 0., 0.],
...

基本上什么都没发生。真的可以在这里显示图像吗?

最佳答案

有一个扩展允许您在 python 调试期间查看图像/绘图。您只需在编辑器中选择图像变量,然后单击它附近就会出现的灯泡。基本上,它只是将图像保存到一个临时位置,然后在旁边打开它。

免责声明:我是扩展的作者。

https://marketplace.visualstudio.com/items?itemName=elazarcoh.simply-view-image-for-python-debugging

关于python - VSCode - 在调试时显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62351886/

相关文章:

python - 导入 _ssl 错误,DLL 加载失败,Python 37 Anaconda Windows 10

f# - 将 F# 与 Visual Studio Code 结合使用是否需要 Mono?

visual-studio-code - 任何设置更改都会导致命令板出现 "null password (Press ' Enter' 确认或 'Escape' 取消)”

javascript - vscode 和 jsdocs - 如何将 TS 接口(interface)或类型用于 javascript 函数

python - 文档相似度 : Comparing two documents efficiently

python - 如何在元组列表中连接元组内的元素?

python - 在线程内调用 dbus-python

visual-studio-code - VS Code 禁用某些扩展

macos - 在Visual Studio Code中仅缩放文本

Python 和 Pygame 循环不递增