当前位置: 首页 > 工具软件 > OCRmyPDF > 使用案例 >

OCRmyPDF - library loading issue

宦宏爽
2023-12-01

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!!
 类似资料:

相关阅读

相关文章

相关问答