栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Mac m1安装ImageMagick报错无法使用aclcheck

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Mac m1安装ImageMagick报错无法使用aclcheck

报错如下:

Checking /Users/jeremy/Desktop/emnlp2022a.pdf

Traceback (most recent call last):

  File "/Users/jeremy/miniforge3/lib/python3.9/site-packages/wand/api.py", line 151, in

    libraries = load_library()

  File "/Users/jeremy/miniforge3/lib/python3.9/site-packages/wand/api.py", line 140, in load_library

    raise IOError('cannot find library; tried paths: ' + repr(tried_paths))

OSError: cannot find library; tried paths: []

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/Users/jeremy/aclpubcheck/aclpubcheck/formatchecker.py", line 494, in

    main()

  File "/Users/jeremy/aclpubcheck/aclpubcheck/formatchecker.py", line 491, in main

    worker(submission, args.paper_type)

  File "/Users/jeremy/aclpubcheck/aclpubcheck/formatchecker.py", line 454, in worker

    return Formatter().format_check(submission=pdf_path, paper_type=paper_type)

  File "/Users/jeremy/aclpubcheck/aclpubcheck/formatchecker.py", line 80, in format_check

    self.check_page_margin(output_dir)

  File "/Users/jeremy/aclpubcheck/aclpubcheck/formatchecker.py", line 284, in check_page_margin

    im = self.pdf.pages[page].to_image(resolution=150)

  File "/Users/jeremy/miniforge3/lib/python3.9/site-packages/pdfplumber/page.py", line 356, in to_image

    from .display import DEFAULT_RESOLUTION, PageImage

  File "/Users/jeremy/miniforge3/lib/python3.9/site-packages/pdfplumber/display.py", line 6, in

    from wand.image import Color as WandColor  # type: ignore

  File "/Users/jeremy/miniforge3/lib/python3.9/site-packages/wand/image.py", line 18, in

    from . import assertions

  File "/Users/jeremy/miniforge3/lib/python3.9/site-packages/wand/assertions.py", line 155, in

    from .color import Color  # noqa: E402

  File "/Users/jeremy/miniforge3/lib/python3.9/site-packages/wand/color.py", line 10, in

    from .api import library

  File "/Users/jeremy/miniforge3/lib/python3.9/site-packages/wand/api.py", line 175, in

    raise ImportError('MagickWand shared library not found.n'

ImportError: MagickWand shared library not found.

You probably had not installed ImageMagick library.

Try to install:

  brew install freetype imagemagick

解决方法:

brew安装:

/bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"

vim /etc/profile

添加了以下两条环境变量

export PATH=/opt/homebrew/bin:$PATH
export PATH=/opt/homebrew/sbin:$PATH

brew uninstall --force imagemagick

brew install imagemagick@6   

echo 'export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

确保.zshrc中有:

export MAGICK_HOME=/opt/homebrew/opt/imagemagick@6/

export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"

结果可以正常跑了: 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/982699.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号