用于调试的 Python 数组可视化工具

标签 python

我正在从事图像处理工作,这意味着我正在对大型矩阵进行操作。我正在尝试调试,这意味着我需要探索这些元素,但使用打印语句来做到这一点确实很痛苦。是否有某种 python 插件可以让我在 GUI 中查看数组以进行调试?

最佳答案

是的,只需使用 python 调试器并放置一个断点

或者使用类似q

的东西

$ easy_install q

import q
my_array = numpy.arange(1000)
q.d() #open a terminal where you have access to my_array

你会看到类似下面的内容

Python console opened by q.d() in <some_module>
>>> print my_array[5]

您还可以使用丸从阵列生成图像(不确定它是否可以在不调整的情况下正常工作)

>>> import Image
>>> img = Image.fromarray(my_array, 'RGB')
>>> img.save('test.png')

关于用于调试的 Python 数组可视化工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23916976/

相关文章:

python - 将 urllib2 与 SOCKS 代理一起使用

python - PrettyPrint python 成一个字符串,而不是标准输出

Python ssh 读取镜像

Python/Turtle/Tkinter : in which object or sub-module the list of all symbolic color names can be found?

python - django 查询返回错误 : expected str instance, 找到 ValuesListQuerySet

python - 通过 id() 获取对象?

python - 在matplotlib中自动缩放y时设置x轴标签范围

python - 在 yaml 文件中使用带步长的范围

python - 如何从 TreeExplainer 获取 shap_values 的特征名称?

python - linux写的编译shell文件是什么