【问题标题】:Error using Elaphe with GhostScript on Mac在 Mac 上将 Elaphe 与 GhostScript 一起使用时出错
【发布时间】:2013-04-12 10:08:16
【问题描述】:

我正在尝试在 Mac 上设置 elaphe。当我尝试使用终端生成一些条形码时,使用命令python + /.../file.py elaphe 可以正常工作并正确生成条形码。但是当我尝试通过 web (php) 执行时,我在 Apache 的错误日志中收到以下错误:

Traceback (most recent call last):
  File "lib/barcode_generator/generator.py", line 19, in <module>
    code_39_image.save(str(random)+'.tif')
  File "/Users/x/Library/Python/2.7/lib/python/site-packages/PIL/Image.py", line 1406, in save
    self.load()
  File "/Users/x/Library/Python/2.7/lib/python/site-packages/PIL/EpsImagePlugin.py", line 283, in load
    self.im = Ghostscript(self.tile, self.size, self.fp)
  **File "/Users/x/Library/Python/2.7/lib/python/site-packages/PIL/EpsImagePlugin.py", line 72, in Ghostscript
    gs.write(s)**

如果我在Windows中我会说这是路径的问题并且程序找不到“gs.write”但是在Mac中我是菜鸟,我不知道它是否相同,不过我已经包含了这两条路径:

export PATH=/Users/x/Library/Python/2.7/bin:$PATH
export PATH=/usr/local/bin:$PATH

如果能就这个错误提供一些想法,我将不胜感激。 提前致谢。

【问题讨论】:

    标签: python macos apache python-imaging-library ghostscript


    【解决方案1】:

    通过符号链接修复。显然是 PATH 问题或对 gs 二进制文件的硬编码引用。

    sudo ln -s /usr/local/bin/gs /usr/bin/gs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-05
      • 1970-01-01
      • 2011-08-28
      • 2013-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多