0

我在 debian/jessie 框中运行此代码:

from elaphe import barcode
text = 'hello world in barcode'
bc = barcode('pdf417', text, options = dict(
         compact = False, eclevel = 5, columns = 13,
         rowmult = 2, rows = 3),
     margin=20, scale=1)

运行此之后,我执行以下操作:

bc.save('filename.png')

然后得到以下错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1653, in save   
  self.load()
File "/usr/lib/python2.7/dist-packages/PIL/EpsImagePlugin.py", line 336, in load
  self.im = Ghostscript(self.tile, self.size, self.fp, scale)
File "/usr/lib/python2.7/dist-packages/PIL/EpsImagePlugin.py", line 143, in  Ghostscript
  stdout=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__   
errread, errwrite) 
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child   raise child_exception OSError: [Errno 2] 
No such file or directory

如果我在 ubuntu 14.04 框中运行相同的代码,则不会出现此类错误并且可以正常工作。由于我在几篇文章中看到了这个错误,并且有很多包,我可以得出结论,它与 debian 有关,与代码本身无关,甚至与 elaphe python 包无关。最好查找是否有某种路径可以在某处重新定义或符号链接,或者是否有针对此的补丁。

请帮忙。

4

1 回答 1

1

错误消息不是超级干净。但这可能是由于缺少 ghostscript 包引起的。

尝试:sudo apt-get install ghostscript

于 2016-05-04T08:56:48.030 回答