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"

结果可以正常跑了: 

你可能感兴趣的:(macos)