执行pip install paddleocr时PyMuPDF编译Wheel失败的解决方法
PyMuPDF构建Wheel失败导致PaddleOCR安装失败的解决办法
问题背景
执行pip install paddleocr时触发PyMuPDF源码构建Wheel失败,报错提示找不到文件.\\mupdf-1.20.3-source\\thirdparty\\harfbuzz\\test\\shaping\\texts\\in-house\\shaper-indic\\script-devanagari\\utrrs\\codepoint\\IndicFontFeatureCodepoint-AdditionalConsonants.txt。当前环境为Intel i3 64位处理器、Python 3.11.3,已尝试pip install wheel和单独安装PyMuPDF,问题未解决。
报错详情:
Building wheels for collected packages: PyMuPDF Building wheel for PyMuPDF (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [70 lines of output] Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\3551\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 487, in <module> mupdf_local = get_mupdf() ^^^^^^^^^^^ File "C:\Users\3551\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 450, in get_mupdf return tar_extract( mupdf_tgz, exists='return') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\3551\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 183, in tar_extract t.extractall() File "C:\Users\3551\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2059, in extractall self.extract(tarinfo, path, set_attrs=not tarinfo.isdir(), File "C:\Users\3551\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2100, in extract self._extract_member(tarinfo, os.path.join(path, tarinfo.name), File "C:\Users\3551\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2173, in _extract_member self.makefile(tarinfo, targetpath) File "C:\Users\3551\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2214, in makefile with bltn_open(targetpath, "wb") as target: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '.\\mupdf-1.20.3-source\\thirdparty\\harfbuzz\\test\\shaping\\texts\\in-house\\shaper-indic\\script-devanagari\\utrrs\\codepoint\\IndicFontFeatureCodepoint-AdditionalConsonants.txt' [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
解决方法
1. 安装适配Python3.11的PyMuPDF预编译版本
直接安装带有预编译Wheel的PyMuPDF版本,避免源码构建:
pip install PyMuPDF==1.23.22
该版本针对Python3.11提供了预编译包,无需本地构建。安装完成后再执行pip install paddleocr。
2. 手动下载预编译Wheel包安装
如果上述命令仍无法自动获取预编译包,可手动下载对应版本的Wheel文件:
- 确认系统为64位Windows、Python3.11,下载文件名类似
PyMuPDF-1.23.22-cp311-none-win_amd64.whl的文件 - 执行本地安装命令:
pip install 你的Wheel文件路径\PyMuPDF-1.23.22-cp311-none-win_amd64.whl
3. 降级Python版本
若前两种方法无效,可将Python版本降级至3.10,该版本对PyMuPDF的源码构建兼容性更稳定。降级后重新执行pip install paddleocr即可正常完成依赖安装。
内容的提问来源于stack exchange,提问作者Jinen Rathore
相关产品推荐
相关产品推荐

