使用 Pillow 时如何修复 Ghostscript OS 错误?

How to fix a Ghostscript OS Error when using Pillow?

这是我遇到的错误:

OS Error: Ghostscript not found on paths

当运行以下函数时:

from PIL import Image
def convert_ps_to_png(ps_file):
    img = Image.open(ps_file)  
    img = Image.save("file.png")# Error occurs on this line

convert_ps_to_png(ps_file_path)

任何解决方案将不胜感激。最终目标是通过脚本将 .ps 文件转换为 .png 文件。

根据您之前问题的答案,您需要安装 Ghostscript,并在系统环境变量 $PATH 中可用。