在Windows 8上的Python中导入Ghostscript [英] Importing Ghostscript in Python on Windows 8

查看:187
本文介绍了在Windows 8上的Python中导入Ghostscript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've been trying to import ghostscript into Python in order to convert pdf files to a .tiff format.

我正在Windows 8上使用Python版本2.7.10.

I am using Python version 2.7.10 on Windows 8.

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

I have successfully downloaded and installed ghostscript using pip, and it appears in the correct location (...\Anaconda\Lib\sitepackages). I've confirmed that other packages located in this directory can be imported into Python.

我正在使用命令 import ghostscript

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

When I do so, I get an error message:

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

RuntimeError: Can not find Ghostscript DLL in registry

回溯表明,调用文件"ghoscript_init_.py"已成功将_gsprint导入为gs.

The traceback indicates that calling the file "ghoscript_init_.py" successfully imports _gsprint as gs.

但是,当导入功能尝试访问"ghostscript_gsprint.py"时,它将在无法找到Ghostscript DLL的地方产生RuntimeError.

However, when the import function attempts to access "ghostscript_gsprint.py", it produces the RuntimeError where it is unable to find the Ghostscript DLL.

对于任何建议或技巧,我将不胜感激.谢谢!

I would be very grateful for any advice or tips. Thanks!

推荐答案

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

As well as installing ghostscript python bindings from PyPI with pip install ghostscript, you also need to install the correct Ghostscript program for your platform, as described on the PyPI page. That page states that version 8.x is required, but I'm currently using 9.2 successfully.

下载链接位于此处.

这篇关于在Windows 8上的Python中导入Ghostscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆