微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用自制软件在 M1 macs 上安装 tesseocr 时缺少 leptonica/allheaders.h

如何解决使用自制软件在 M1 macs 上安装 tesseocr 时缺少 leptonica/allheaders.h

我试图安装 normcap 来读取图像的 OCR,但我遇到了错误并且不知道如何解决

PC - Macbook M1 芯片组
自制软件 3.1.7 已安装并运行良好。
CommandLinetools 12.5 已安装(苹果)。
安装了 Leptonica 1.80.0。
Tesseract 4.1.1 已安装

asura@Asuras-MBP ~ % pip3 install tesserocr
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting tesserocr
  Using cached tesserocr-2.5.1.tar.gz (54 kB)
Building wheels for collected packages: tesserocr
  Building wheel for tesserocr (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Developer/CommandLinetools/usr/bin/python3 -u -c 'import io,os,sys,setuptools,tokenize; sys.argv[0] = '"'"'/private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-install-44_kap26/tesserocr_10c3c6f9825d4363b69446dbd439cf21/setup.py'"'"'; __file__='"'"'/private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-install-44_kap26/tesserocr_10c3c6f9825d4363b69446dbd439cf21/setup.py'"'"';f = getattr(tokenize,'"'"'open'"'"',open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-wheel-vmhekyq6
       cwd: /private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-install-44_kap26/tesserocr_10c3c6f9825d4363b69446dbd439cf21/
  Complete output (16 lines):
  /private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-install-44_kap26/tesserocr_10c3c6f9825d4363b69446dbd439cf21/setup.py:72: SyntaxWarning: "is not" with a literal. Did you mean "!="?
    if subversion is not None and subversion is not "":
  Supporting tesseract v4.1.1
  Building with configs: {'libraries': ['tesseract','lept'],'cython_compile_time_env': {'TESSERACT_VERSION': 67174656}}
  running bdist_wheel
  running build
  running build_ext
  building 'tesserocr' extension
  creating build
  creating build/temp.macosx-10.14.6-arm64-3.8
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Library/Developer/CommandLinetools/Library/Frameworks/python3.framework/Versions/3.8/include/python3.8 -c tesserocr.cpp -o build/temp.macosx-10.14.6-arm64-3.8/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE
  tesserocr.cpp:663:10: Fatal error: 'leptonica/allheaders.h' file not found
  #include "leptonica/allheaders.h"
           ^~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  error: command 'clang' Failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for tesserocr
  Running setup.py clean for tesserocr
Failed to build tesserocr
Installing collected packages: tesserocr
    Running setup.py install for tesserocr ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLinetools/usr/bin/python3 -u -c 'import io,'"'"'exec'"'"'))' install --record /private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-record-qagqxk6s/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/asura/Library/Python/3.8/include/python3.8/tesserocr
         cwd: /private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-install-44_kap26/tesserocr_10c3c6f9825d4363b69446dbd439cf21/
    Complete output (16 lines):
    /private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-install-44_kap26/tesserocr_10c3c6f9825d4363b69446dbd439cf21/setup.py:72: SyntaxWarning: "is not" with a literal. Did you mean "!="?
      if subversion is not None and subversion is not "":
    Supporting tesseract v4.1.1
    Building with configs: {'libraries': ['tesseract','cython_compile_time_env': {'TESSERACT_VERSION': 67174656}}
    running install
    running build
    running build_ext
    building 'tesserocr' extension
    creating build
    creating build/temp.macosx-10.14.6-arm64-3.8
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/Library/Developer/CommandLinetools/Library/Frameworks/python3.framework/Versions/3.8/include/python3.8 -c tesserocr.cpp -o build/temp.macosx-10.14.6-arm64-3.8/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE
    tesserocr.cpp:663:10: Fatal error: 'leptonica/allheaders.h' file not found
    #include "leptonica/allheaders.h"
             ^~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' Failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Developer/CommandLinetools/usr/bin/python3 -u -c 'import io,'"'"'exec'"'"'))' install --record /private/var/folders/w4/n1pwmphn6j13trrwzlzjbpzh0000gn/T/pip-record-qagqxk6s/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/asura/Library/Python/3.8/include/python3.8/tesserocr Check the logs for full command output.

据我所知,我提供了所有需要的信息,如果有什么遗漏,请告诉我。
我是自制软件的新手,但使用了一段时间的 linux 操作系统

还有一种方法可以从 Github 或任何存储库直接安装在 homebrew 上,例如如果在 git 存储库文件中进行了一些更改,我想直接安装它们,否则需要等待 tar.gz 或 .dmg 的 realese文件

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。