我想用Elaphe生成条形码。在
当我运行示例代码时,我得到了gs失败的错误。在
我在一台64位的windows机器上工作。我安装了python2.7.1forwin32,因为某些包需要win32。所以,我安装了Ghostscript 9.0.4 Win32。我向path变量添加了正确的路径。在
我使用easy_install安装了elaphe、python图像库和pythonghostscript0.41egg(不确定是否有必要)。在
我可以将elaphe和PIL导入python并执行命令而不会出错。每当我试图将条形码保存为图像时,都会出错。在
当我运行这个简单的用法示例时:
>>> from elaphe import barcode
>>> barcode('qrcode',
... 'Hello Barcode Writer In Pure PostScript.',
... options=dict(version=9, eclevel='M'),
... margin=10, data_mode='8bits')) # Generates PIL.EpsImageFile instance
<PIL.EpsImagePlugin.EpsImageFile instance at ...>
>>> _.show() # Show the image
我得到IOError: [Errno 32] Broken pipe
当我运行这个来检查ghostscript和PIL安装时:
^{pr2}$我得到IOError: gs failed (status 1)
我试着为win64安装Ghostscript,但是我得到了同样的错误。在
关于从何处开始故障排除有何建议?我可以运行ghostscript可执行文件,然后弹出一个命令窗口,并将正确的路径添加到env path变量中。在
谢谢。在
您需要捕获Ghostscript输出以查看错误消息是什么。这通常是写到stderr中的,我不知道它在Python库中的位置,但是您确实需要看到它来找出Ghostscript退出的原因。在
您还需要查看它,以确定是否正在执行Ghostscript。听起来好像不是,但我对“python ghostscript 0.41egg”一无所知。在
我遇到了同样的问题,并通过以下步骤解决了它:
相关问题 更多 >
编程相关推荐