日常问题排查
今天在迁移开发环境时碰到一个问题,报错信息如下
PyMuPDF/setup.py: libraries=['mupdf', 'mupdf-third']
PyMuPDF/setup.py: include_dirs=['mupdf-1.20.0-source/include', 'mupdf-1.20.0-source/include/mupdf', 'mupdf-1.20.0-source/thirdparty/freetype/include', '/usr/include/freetype2', '/usr/local/include/freetype2', '/usr/X11R6/include/freetype2', '/opt/homebrew/include', '/opt/homebrew/include/freetype2']
PyMuPDF/setup.py: extra_link_args=[]
running bdist_wheel
running build
running build_py
running build_ext
building 'fitz._fitz' extension
swigging fitz/fitz.i to fitz/fitz_wrap.c
swig -python -o fitz/fitz_wrap.c fitz/fitz.i
error: command 'swig' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for PyMuPDF
Running setup.py clean for PyMuPDF
Failed to build PyMuPDF
ERROR: Could not build wheels for PyMuPDF, which is required to install pyproject.toml-based projects
尝试着变换PyMuPDF的版本,发现部分版本的安装没问题,但是项目指定的版本1.20.2始终报错。
**
error: command ‘swig’ failed
** 怀疑时swig的问题
执行brew install swig
brew install swig
再次安装成功,如果是windows,对应安装对应的swig.exe,如果还是找不到,则可能是环境变量未添加