【问题标题】:Importing Ghostscript in Python on Windows 8在 Windows 8 上用 Python 导入 Ghostscript
【发布时间】:2015-08-07 20:47:27
【问题描述】:

我一直在尝试将 ghostscript 导入 Python,以便将 pdf 文件转换为 .tiff 格式。

我在 Windows 8 上使用 Python 版本 2.7.10。

我已经使用 pip 成功下载并安装了 ghostscript,它出现在正确的位置 (...\Anaconda\Lib\sitepackages)。我已经确认可以将位于此目录中的其他包导入 Python。

我正在使用命令import ghostscript

当我这样做时,我收到一条错误消息:

RuntimeError: 在注册表中找不到 Ghostscript DLL

回溯表明调用文件“ghoscript_init_.py”成功将_gsprint导入为gs。

但是,当导入函数尝试访问“ghostscript_gsprint.py”时,它会产生无法找到 Ghostscript DLL 的 RuntimeError。

如果您有任何建议或提示,我将不胜感激。谢谢!

【问题讨论】:

    标签: python ghostscript


    【解决方案1】:

    除了使用 pip install ghostscript 从 PyPI 安装 ghostscript python 绑定之外,您还需要为您的平台安装正确的 Ghostscript 程序,如 PyPI page 中所述。该页面声明需要 8.x 版本,但我目前正在成功使用 9.2。

    下载链接为here

    【讨论】:

      【解决方案2】:

      Jamie的回答不是很有帮助,OP说他确实已经下载并安装了ghostscript,甚至发布了他使用的python 2.7应该是ghostscript支持的没问题。

      我遇到了同样的错误: RuntimeError: Can not find Ghostscript DLL in registry

      我的问题实际上是我安装了 Python(3.6) 64 位同时安装了 Ghostscript 32 位。卸载 32 位 Ghostscript 并安装 64 位 Ghostscript 解决了这个问题。

      您可以通过运行 python.exe 并检查标头消息来检查您的 python 版本。

      蟒蛇

      Python 3.6.6 |Anaconda, Inc.| (默认,2018 年 6 月 28 日,11:27:44)[MSC v.1900 64 位 (AMD64)] 在 win32 上 输入“help”、“copyright”、“credits”或“license”了解更多信息。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-08-16
        • 1970-01-01
        • 2018-01-13
        • 1970-01-01
        • 2016-05-18
        • 1970-01-01
        • 2013-12-27
        相关资源
        最近更新 更多