python-3.x 在带有自制程序的M1 Mac上安装tesseocr时缺少leptonica/allheaders. h

vql8enpb  于 2023-03-13  发布在  Python
关注(0)|答案(2)|浏览(449)

我试图安装用于OCR图像阅读的normcap,但我遇到了错误,不知道如何解决它。
PC - MacBook M1芯片组
自制程序3.1.7安装和工作正常.
CommandLinetools 12.5已经安装(苹果)。
已安装Leptonica 1.80.0。
已安装魔方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, 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'"'"'))' 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', 'lept'], '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, 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'"'"'))' 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或任何存储库直接安装到自制程序上,比如如果在git存储库文件中进行了一些更改,我想直接安装它们,否则需要等待tar.gz或.dmg文件的realese

kkbh8khc

kkbh8khc1#

包含地址应为:/opt/homebrew/Cellar/leptonica/1.82.0/include而不是/opt/homebrew/Cellar/leptonica/1.82.0/include/leptonica。如果您可以将第一个路径添加到PATH变量中,它可能会工作。
我有同样的问题,当我运行C++代码,我包括正确的路径和程序找到leptonics/allheader.h文件。

lhcgjxsq

lhcgjxsq2#

只是好奇,你设法找到解决方案了吗?我目前也被这个错误卡住了。头文件在/opt/homebrew/Cellar/leptonica/1.82.0/include内,但运行时它说头文件丢失。

相关问题