Python Treepoem条形码生成器找不到重影脚本

Python Treepoem条形码生成器找不到重影脚本,python,ghostscript,Python,Ghostscript,我正在尝试使用treepoem在python中生成pdf417条形码,但pycharm一直给我以下错误: 回溯(最近一次呼叫最后一次): 文件“C:/Users//Documents/barcodes.py”,第175行,在 图像=生成条形码(条形码类型=“pdf417”,数据=条形码,选项=dict(eclevel=5,行=27,列=12)) 文件“C:\Users.\AppData\Local\Programs\Python\Python36-32\lib\site packages\tre

我正在尝试使用treepoem在python中生成pdf417条形码,但pycharm一直给我以下错误:

回溯(最近一次呼叫最后一次):

文件“C:/Users//Documents/barcodes.py”,第175行,在 图像=生成条形码(条形码类型=“pdf417”,数据=条形码,选项=dict(eclevel=5,行=27,列=12)) 文件“C:\Users.\AppData\Local\Programs\Python\Python36-32\lib\site packages\treepoem\uuuuuu init\uuuuuuuuu.py”,第141行,位于generate\u条形码中 bbox\u line=\u get\u bbox(代码) 文件“C:\Users.\AppData\Local\Programs\Python36-32\lib\site packages\treepoem\uuuuuu init\uuuuuuuuu.py”,第81行,在get\ubbox中 ghostscript=_get_ghostscript_binary() 文件“C:\Users.\AppData\Local\Programs\Python36-32\lib\site packages\treepoem\uuuuuu init\uuuuuuuuu.py”,第108行,二进制文件 “无法确定ghostscript的路径,是否已安装?” treepoem.TreepoemError:无法确定ghostscript的路径,是否已安装


我已经尝试安装ghostscript,使用我在网上找到的.exe和使用pip install ghostscript(第一次成功完成,现在告诉我满足了要求),但我仍然不断遇到这个错误。关于如何修复它有什么想法吗?

如果您安装在Windows上,Windows二进制文件与Linux二进制文件在名称上有所不同,实际上也有所不同,具体取决于您安装的是64位还是32位版本

在Linux(和MacOS)上,重影脚本二进制文件称为“gs”,在Windows上称为“gswin32”或“gswin64”或“gswin32c”或“gswin64c”,具体取决于您想要的是32位还是64位版本,以及命令行或窗口可执行文件

我的猜测是,您的脚本只查找'gs',并且可能希望路径位于$path环境变量中,但我不清楚它期望的是什么

您可以通过确保安装路径位于$path环境变量中并将可执行文件复制到该目录中的“gs.exe”来“修复”此问题


除此之外,你需要有人能告诉你脚本在寻找什么。很可能您可以对其进行grep。

另一种解决方案是编辑C:\Users\Windows.UserName\AppData\Local\Programs\Python\Python37\Lib\site packages\treepoem\uuuuu init\uuuuu.py

脚本正在查找gs.exe,请更改为gswin32.exe,如下所示

然后在windows中的路径中添加GhostScriptInstallDir\bin

def _get_ghostscript_binary():
    binary = "gswin32" # changed from 'gs' to 'gswin32'

    if sys.platform.startswith("win"):
        binary = EpsImagePlugin.gs_windows_binary
        if not binary:
            raise TreepoemError(
                "Cannot determine path to ghostscript, is it installed?"
            )

    return binary