如何在 Python 中更改图像查看器

How to change the image viewer in Python

到目前为止,当我在Python中阅读并展示一张图片时:

from scipy import misc
img = misc.imread("myimage.png")
misc.imshow(img)

它使用 ImageMagick 打开它。

如何将 reader 从 ImageMagick 更改为 Image Viewer? 我想我应该更改 Python 环境,但我没有任何进一步的线索。

misc.imshow 的文档字符串说

In [10]: misc.imshow?
Signature: misc.imshow(arr)
Docstring:
Simple showing of an image through an external viewer.

Uses the image viewer specified by the environment variable
SCIPY_PIL_IMAGE_VIEWER, or if that is not defined then `see`,
to view a temporary file generated from array data.

因此,将 SCIPY_PIL_IMAGE_VIEWER 环境变量设置为 eog(图像查看器)可执行文件的路径。