【问题标题】:PythonMagick Unable to open config filePythonMagick 无法打开配置文件
【发布时间】:2019-04-15 11:50:00
【问题描述】:

我在 PyCharm 内的 64 位 Windows 10 上的 venv 中运行 Python 3.6。以下是我执行的步骤:

  1. 打开 PyCharm 并使用 Python 3.6 作为 venv 开始一个新项目。
  2. 从以下来源下载 Python3.6 的 Wheel 文件中的 PythonMagick:PythonMagick wheel file
  3. 在 PyCharm 中打开终端并运行: pip install PythonMagick-0.9.19-cp36-cp36m-win_amd64.whl

  4. 从这里下载 ghostscript:Ghostscript 9.25 for Windows (64 bit) 并运行 exe 文件。

  5. 将 ghostscript 目录 C:\Program Files\gs\gs9.25\bin 添加到用户 PATH 环境变量中。

现在我从这里运行示例文件

import PythonMagick
if __name__ == "__main__":
    pdf = 'a.pdf'
    p = PythonMagick.Image()
    p.read(pdf)
    p.write('doc.jpg')

我收到以下错误:

RuntimeError: Magick: UnableToOpenConfigureFile `delegates.xml' @ 警告/configure.c/GetConfigureOptions/714

如何解决这个错误?

【问题讨论】:

    标签: windows-10 runtime-error 64-bit python-3.6 pythonmagick


    【解决方案1】:

    在 VENV 中安装 PythonMagick 时,显然您还需要添加一个名为 MAGICK_HOME 的系统变量,以便 Magick 可以找到配置文件。

    将以下内容添加到用户变量中

    MAGICK_HOME = %your-project-dir%\venv\Lib\site-packages\PythonMagick

    然后重启 PyCharm。

    【讨论】:

      猜你喜欢
      • 2021-01-29
      • 2014-04-20
      • 2022-11-10
      • 1970-01-01
      • 2016-06-06
      • 2015-10-26
      • 2016-08-05
      • 1970-01-01
      • 2013-07-30
      相关资源
      最近更新 更多