Python pip3安装teseract ocr:失败

Python pip3安装teseract ocr:失败,python,tesseract,Python,Tesseract,当我尝试运行pip3 install teseract ocr时,会出现以下错误: ERROR: Complete output from command /usr/local/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/tmp/pip-install-37v3jvjx/tesseract-ocr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', op

当我尝试运行pip3 install teseract ocr时,会出现以下错误:

ERROR: Complete output from command /usr/local/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/tmp/pip-install-37v3jvjx/tesseract-ocr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-j_ond470/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
file tesseract_ocr.py (for module tesseract_ocr) not found
file tesseract_ocr.py (for module tesseract_ocr) not found
running build_ext
building 'tesseract_ocr' extension
creating build
creating build/temp.macosx-10.9-x86_64-3.7
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c tesseract_ocr.cpp -o build/temp.macosx-10.9-x86_64-3.7/tesseract_ocr.o
In file included from tesseract_ocr.cpp:636:
In file included from /usr/local/include/tesseract/baseapi.h:26:
In file included from /usr/local/include/tesseract/apitypes.h:23:
/usr/local/include/tesseract/publictypes.h:33:1: error: unknown type name 'constexpr'
constexpr int kPointsPerInch = 72;
^
/usr/local/include/tesseract/publictypes.h:33:11: error: expected unqualified-id
constexpr int kPointsPerInch = 72;
          ^
/usr/local/include/tesseract/publictypes.h:38:1: error: unknown type name 'constexpr'
constexpr int kMinCredibleResolution = 70;
^
/usr/local/include/tesseract/publictypes.h:38:11: error: expected unqualified-id
constexpr int kMinCredibleResolution = 70;
          ^
/usr/local/include/tesseract/publictypes.h:40:1: error: unknown type name 'constexpr'
constexpr int kMaxCredibleResolution = 2400;
^
/usr/local/include/tesseract/publictypes.h:40:11: error: expected unqualified-id
constexpr int kMaxCredibleResolution = 2400;
          ^
/usr/local/include/tesseract/publictypes.h:45:1: error: unknown type name 'constexpr'
constexpr int kResolutionEstimationFactor = 10;
^
/usr/local/include/tesseract/publictypes.h:45:11: error: expected unqualified-id
constexpr int kResolutionEstimationFactor = 10;
          ^
In file included from tesseract_ocr.cpp:636:
In file included from /usr/local/include/tesseract/baseapi.h:30:
In file included from /usr/local/include/tesseract/resultiterator.h:27:
In file included from /usr/local/include/tesseract/ltrresultiterator.h:27:
/usr/local/include/tesseract/unichar.h:34:20: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using UNICHAR_ID = int;
                   ^
/usr/local/include/tesseract/unichar.h:51:16: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using char32 = signed int;
               ^
/usr/local/include/tesseract/unichar.h:108:16: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
    using CI = const_iterator;
               ^
/usr/local/include/tesseract/unichar.h:171:8: error: function definition does not declare parameters
  char chars[UNICHAR_LEN]{};
       ^
/usr/local/include/tesseract/unichar.h:60:12: error: use of undeclared identifier 'chars'
    memset(chars, 0, UNICHAR_LEN);
           ^
/usr/local/include/tesseract/unichar.h:78:15: error: use of undeclared identifier 'chars'
    int len = chars[UNICHAR_LEN - 1];
              ^
/usr/local/include/tesseract/unichar.h:84:12: error: use of undeclared identifier 'chars'
    return chars;
           ^
In file included from tesseract_ocr.cpp:636:
In file included from /usr/local/include/tesseract/baseapi.h:30:
In file included from /usr/local/include/tesseract/resultiterator.h:27:
/usr/local/include/tesseract/ltrresultiterator.h:68:24: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  ~LTRResultIterator() override;
                       ^
In file included from tesseract_ocr.cpp:636:
In file included from /usr/local/include/tesseract/baseapi.h:30:
/usr/local/include/tesseract/resultiterator.h:49:21: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  ~ResultIterator() override = default;
                    ^
/usr/local/include/tesseract/resultiterator.h:49:32: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
  ~ResultIterator() override = default;
                               ^
/usr/local/include/tesseract/resultiterator.h:56:16: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  void Begin() override;
               ^
/usr/local/include/tesseract/resultiterator.h:70:38: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  bool Next(PageIteratorLevel level) override;
                                     ^
/usr/local/include/tesseract/resultiterator.h:78:55: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  bool IsAtBeginningOf(PageIteratorLevel level) const override;
                                                      ^
/usr/local/include/tesseract/resultiterator.h:86:66: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
                                PageIteratorLevel element) const override;
                                                                 ^
/usr/local/include/tesseract/resultiterator.h:103:63: error: a space is required between consecutive right angle brackets (use '> >')
  virtual std::vector<std::vector<std::pair<const char*, float>>>*
                                                              ^~
                                                              > >
In file included from tesseract_ocr.cpp:636:
In file included from /usr/local/include/tesseract/baseapi.h:31:
/usr/local/include/tesseract/serialis.h:43:1: error: unknown type name 'constexpr'
constexpr size_t countof(T const (&)[N]) noexcept {
^
/usr/local/include/tesseract/serialis.h:43:11: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr size_t countof(T const (&)[N]) noexcept {
          ^
/usr/local/include/tesseract/serialis.h:43:17: error: expected ';' at end of declaration
constexpr size_t countof(T const (&)[N]) noexcept {
                ^
                ;
/usr/local/include/tesseract/serialis.h:43:18: error: C++ requires a type specifier for all declarations
constexpr size_t countof(T const (&)[N]) noexcept {
                 ^
/usr/local/include/tesseract/serialis.h:43:26: error: use of undeclared identifier 'T'
constexpr size_t countof(T const (&)[N]) noexcept {
                         ^
/usr/local/include/tesseract/serialis.h:43:41: error: expected ';' after top level declarator
constexpr size_t countof(T const (&)[N]) noexcept {
                                        ^
                                        ;
/usr/local/include/tesseract/serialis.h:52:20: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using FileWriter = bool (*)(const GenericVector<char>&, const STRING&);
                   ^
/usr/local/include/tesseract/serialis.h:55:40: error: unknown type name 'size_t'
bool DeSerialize(FILE* fp, char* data, size_t n = 1);
                                       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
12 warnings and 20 errors generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/local/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/tmp/pip-install-37v3jvjx/tesseract-ocr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-j_ond470/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-37v3jvjx/tesseract-ocr/
错误:从命令/usr/local/bin/python3-u-c'import setuptools,tokenize完成输出__文件“'/private/tmp/pip-install-37v3jvjx/tesseract ocr/setup.py'”;f=getattr(标记化,“'open'”,open)(\uuuuu文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(编译(代码,“'exec'”)'安装--record/private/tmp/pip-record-j_ond470/install-record.txt--外部管理的单一版本--编译:
错误:正在运行安装
运行构建
运行build\u py
未找到文件tesseract\u ocr.py(用于模块tesseract\u ocr)
未找到文件tesseract\u ocr.py(用于模块tesseract\u ocr)
运行build_ext
正在构建“tesseract\u ocr”扩展
创建构建
创建构建/临时macosx-10.9-x86_64-3.7
gcc-Wno unused result-Wsign compare-wunrechable code-fno common-dynamic-DNDEBUG-g-fwrapv-O3-Wall-arch x86_64-g-I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m-c tesseract_ocr.cpp-o build/temp.macosx-10.9-x86_64-3.7/tesseract_ocr.o
在tesseract_ocr.cpp中包含的文件中:636:
在/usr/local/include/tesseract/baseapi.h:26中包含的文件中:
在/usr/local/include/tesseract/apitypes.h:23中包含的文件中:
/usr/local/include/tesseract/publictypes.h:33:1:错误:未知类型名称“constexpr”
constexpr int kPointsPerInch=72;
^
/usr/local/include/tesseract/publictypes.h:33:11:错误:应为非限定id
constexpr int kPointsPerInch=72;
^
/usr/local/include/tesseract/publictypes.h:38:1:错误:未知类型名称“constexpr”
constexpr int kMinCredibleResolution=70;
^
/usr/local/include/tesseract/publictypes.h:38:11:错误:应为非限定id
constexpr int kMinCredibleResolution=70;
^
/usr/local/include/tesseract/publictypes.h:40:1:错误:未知类型名称“constexpr”
constexpr int kmaxcrediblesolution=2400;
^
/usr/local/include/tesseract/publictypes.h:40:11:错误:应为非限定id
constexpr int kmaxcrediblesolution=2400;
^
/usr/local/include/tesseract/publictypes.h:45:1:错误:未知类型名“constexpr”
constexpr int kResolutionEstimationFactor=10;
^
/usr/local/include/tesseract/publictypes.h:45:11:错误:应为非限定id
constexpr int kResolutionEstimationFactor=10;
^
在tesseract_ocr.cpp中包含的文件中:636:
在/usr/local/include/tesseract/baseapi.h:30中包含的文件中:
在/usr/local/include/tesseract/resultiterator.h中包含的文件中:27:
在/usr/local/include/tesseract/ltrresultiterator.h中包含的文件中:27:
/usr/local/include/tesseract/unichar.h:34:20:警告:别名声明是C++11扩展[-Wc++11扩展]
使用UNICHAR_ID=int;
^
/usr/local/include/tesseract/unichar.h:51:16:警告:别名声明是C++11扩展[-Wc++11扩展]
使用char32=signed int;
^
/usr/local/include/tesseract/unichar.h:108:16:警告:别名声明是C++11扩展[-Wc++11扩展]
使用CI=const_迭代器;
^
/usr/local/include/tesseract/unichar.h:171:8:错误:函数定义未声明参数
char chars[UNICHAR_LEN]{};
^
/usr/local/include/tesseract/unichar.h:60:12:错误:使用未声明的标识符“chars”
memset(chars,0,UNICHAR_LEN);
^
/usr/local/include/tesseract/unichar.h:78:15:错误:使用未声明的标识符“chars”
int len=chars[UNICHAR_len-1];
^
/usr/local/include/tesseract/unichar.h:84:12:错误:使用未声明的标识符“chars”
返回字符;
^
在tesseract_ocr.cpp中包含的文件中:636:
在/usr/local/include/tesseract/baseapi.h:30中包含的文件中:
在/usr/local/include/tesseract/resultiterator.h中包含的文件中:27:
/usr/local/include/tesseract/ltrresultiterator.h:68:24:警告:“override”关键字是C++11扩展[-Wc++11扩展]
~LTRResultIterator()重写;
^
在tesseract_ocr.cpp中包含的文件中:636:
在/usr/local/include/tesseract/baseapi.h:30中包含的文件中:
/usr/local/include/tesseract/resultiterator.h:49:21:警告:“override”关键字是C++11扩展[-Wc++11扩展]
~ResultIterator()override=默认值;
^
/usr/local/include/tesseract/resultiterator.h:49:32:警告:默认函数定义是C++11扩展[-Wc++11扩展]
~ResultIterator()override=默认值;
^
/usr/local/include/tesseract/resultiterator.h:56:16:警告:“override”关键字是C++11扩展[-Wc++11扩展]
void Begin()覆盖;
^
/usr/local/include/tesseract/resultiterator.h:70:38:警告:“override”关键字是C++11扩展[-Wc++11扩展]
bool Next(页面迭代器级别)覆盖;
^
/usr/local/include/tesseract/resultiterator.h:78:55:警告:“override”关键字是C++11扩展[-Wc++11扩展]
布尔IsAtBeginningOf(页面迭代器级别)常量覆盖;
^
/usr/local/include/tesseract/resultiterator.h:86:66:警告:“override”关键字是C++11扩展[-Wc++11扩展]
PageIteratorLevel元素)常量重写;
^
/usr/local/include/tesseract/resultiterator.h:103:63:错误:连续的直角括号之间需要空格(使用“>>”)
虚拟std::vector*
^~
> >
在tesseract_ocr.cpp中包含的文件中:636:
在/usr/local/include/tesseract/baseapi.h:31中包含的文件中:
/usr/local/include/tesseract/serialis.h:43:1:错误:未知类型名称“constexpr”
constexpr size_t countof(t const(&)[N])无例外{
^
/usr/local/include/tesseract/serialis.h:43:11:警告:变量tem