python ghostscript:运行时错误:找不到ghostscript库(libgs)

2024-10-01 00:30:57 发布

您现在位置:Python中文网/ 问答频道 /正文

当尝试运行hello world示例时

import sys
import ghostscript

args = [
    "ps2pdf", # actual value doesn't matter
    "-dNOPAUSE", "-dBATCH", "-dSAFER",
    "-sDEVICE=pdfwrite",
    "-sOutputFile=" + sys.argv[1],
    "-c", ".setpdfwrite",
    "-f",  sys.argv[2]
    ]

ghostscript.Ghostscript(*args)

获取错误:

^{pr2}$

这个libgs图书馆是什么?我怎样才能得到它?在

顺便说一句,我在mac上


Tags: import示例helloworldvaluesysargsactual
3条回答

您应该看看Ghostscript's official download site以及{a2}。在

如果这还不能让你开始,你也可以直接在他们的在线聊天频道IRC服务器上的ghostscript中询问GS开发人员irc.freenode.net。他们是一群非常友好、乐于助人的人。在

对我来说,我只是安装了python部分:

pip install ghostscript

但不是C部分:

^{pr2}$

也许这些DMG也有用-但我没有走这条路: http://pages.uoregon.edu/koch/

要解决此问题,您需要修改站点包中的ghostscript模块路径。在

在_gsprint.py修改成这样:

libgs = ctypes.util.find_library('/opt/local/lib/libgs')

找到你的libgs文件。在

相关问题 更多 >