问题描述
我想在我的代码中导入 fitz。为此,我尝试使用
安装 PyMuPDFpip3 install PyMuPDF
但是,此安装失败并返回此错误:
fitz/fitz_wrap.c:2754:10: Fatal error: 'fitz.h' file not found
#include <fitz.h>
^~~~~~~~
1 error generated.
error: command '/opt/homebrew/clang' Failed with exit code 1
我还尝试通过 Homebrew 安装 mupdf 和 mupdf-tools。他们都无法解决这个问题。 如果您能帮助我解决此安装错误,我将不胜感激!
解决方法
假设您使用的是 M1 Mac,安装 mupdf
、swig
、freetype
和最新版本的 PyMuPDF 可以解决此问题:
brew install mupdf swig freetype
pip install https://github.com/pymupdf/PyMuPDF/archive/master.tar.gz