OCRmyPDF - library loading issue

在安装OCRmyPDF后,运行时遇到PIL库的错误,提示需要临时文件夹来支持PIL,但没有在指定路径下安装。问题在于libtiff.5.dylib和libjpeg.8.dylib的不兼容版本。尝试创建软链接、降级库版本以及预加载jpeg8都遇到了不同问题。最终解决方案是将jpeg8d保留在环境中,现在OCRmyPDF正常工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1). install as usual no problem.
2). run ocrmypdf gives the following error message

~/Library/Caches/Python-Eggs/Pillow-4.1.1-py3.5-macosx-10.6-x86_64.egg-tmp/PIL/_imaging.cpython-35m-darwin.so, 2): Library not loaded: libjpeg.8.dylib
  Referenced from: ~/Library/Caches/Python-Eggs/Pillow-4.1.1-py3.5-macosx-10.6-x86_64.egg-tmp/PIL/_imaging.cpython-35m-darwin.so
  Reason: image not found
  • so WHY create a temporary folder for PIL but not installed under ~/anaconda/lib/python-3.5/site-packages/ ???

3). OK, turned out both macports and annaconda has newest jpeg9b installed

OSX Pillow Incompatible library version libtiff.5.dylib & libjpeg.8.dylib

libjpeg.8.dylib can’t be loaded when using Python tool

Attempt 1:

  • create simlink libjpeg.8.dylib —> libjpeg.9.dylib under ~/anaconda/lib/
  • incompatible versions (8 has 13 and 9 contains 12)

Attempt 2:

  • downgrade conda install jpeg=8d
  • EXPORT DYLD_LIBRARY_PATH=~/anaconda/lib/
  • NOW, port stop working complaining wrong tcl versions etc.

Attempt 3:

  • So try to preload jpeg8 only
  • DYLD_INSERT_LIBRARIES=~/anaconda/lib/libjpeg.8.dylib python ocrmypdf
  • other errors popped up… need to understand more how python works, but…
Traceback (most recent call last):
  File "~/anaconda/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "~/anaconda/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "ocrmypdf/__main__.py", line 26, in <module>
    from .pipeline import JobContext, JobContextManager, re_symlink, \
SystemError: Parent module '' not loaded, cannot perform relative import

Final Solution:

  • keep jpeg8d in anaconda
  • ln -s ~/anaconda/lib/libjpeg.8.dylib /opt/local/lib/libjpeg.8.dylib
  • export DYLD_LIBRARY_PATH=/opt/local/lib/
  • NOW working!!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值