首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >python ghostscript: RuntimeError:找不到Ghostscript库(libgs)

python ghostscript: RuntimeError:找不到Ghostscript库(libgs)
EN

Stack Overflow用户
提问于 2011-07-28 01:52:10
回答 5查看 6.1K关注 0票数 3

当尝试运行hello-world示例时

代码语言:javascript
复制
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)

获取错误:

代码语言:javascript
复制
 File "/Users/ddd/sss/ddd/eee.py", line 2, in <module>
    import ghostscript
  File "build/bdist.macosx-10.6-universal/egg/ghostscript/__init__.py", line 33, in <module>

  File "build/bdist.macosx-10.6-universal/egg/ghostscript/_gsprint.py", line 290, in <module>
RuntimeError: Can not find Ghostscript library (libgs)

这个libgs库是什么?我如何获取它?

顺便说一句,我在mac上

EN

回答 5

Stack Overflow用户

发布于 2021-12-01 10:41:23

对于使用M1 mac的新用户,ghostscript可能会显示缺少libgs文件的错误,并且该文件在usr/local/lib上不可用

该问题可以通过以下步骤解决,顺序相同:

  • brew install ghostscript
  • conda install ghostscript,会从conda - conda install -c conda-forge ghostscript
  • pip install ghostscript

安装基于arm_64的库,如果conda抛出通道错误,请尝试使用

注意:

  1. libgs.dylib文件可以在ghostscript
  2. Changing的家庭brew安装中找到,_gsprint.py中的地址将抛出一个错误,因为brew安装的版本将是基于arm_64的,而安装的pip版本将是基于OS_X86的。除非运行pip安装,否则
  3. Python无法识别conda安装中的ghostscript模块,因此这是

的重要步骤

票数 5
EN

Stack Overflow用户

发布于 2018-01-02 05:27:33

对我来说,这很简单,因为我已经安装了python部分:

代码语言:javascript
复制
pip install ghostscript

但不是C部分:

代码语言:javascript
复制
brew install ghostscript

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

票数 2
EN

Stack Overflow用户

发布于 2011-08-07 20:15:57

除了之外,你还应该看看。

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6848903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档