安装 tesseract 时遇到问题

Trouble installing tesseract

安装 tesseract 时遇到问题,查看了 google 和 Whosebug。还是一头雾水。

这是 运行 时 CMD 的结果:npm install -tesseract

C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app>npm install tesseract

> tesseract@0.0.3 install C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\node_modules\tesseract
> node-gyp rebuild


C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\node_modules\tesseract>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Program Files (x86)\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\node_modules\tesseract
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN vs-xsetup@1.18.110-4.625 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tesseract@0.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tesseract@0.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Eduards\AppData\Roaming\npm-cache\_logs19-09-09T16_44_44_751Z-debug.log

C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app>

有人可以指导我吗? 我已通过管理员将 Python 安装到 c 驱动器和程序文件 (64) 中。节点模块不在 python 文件中。

您打算安装库还是 Python 绑定?

图书馆installation on Windows:

Installer for Windows for Tesseract 3.05 and Tesseract 4 are available from Tesseract at UB Mannheim. These include the training tools. Both 32-bit and 64-bit installers are available.

An installer for the OLD version 3.02 is available for Windows from our download page. This includes the English training data. If you want to use another language, download the appropriate training data, unpack it using 7-zip, and copy the .traineddata file into the 'tessdata' directory, probably C:\Program Files\Tesseract-OCR\tessdata.

tesseract bindings for Python 可以通过 pip 从命令行安装:

pip install pytesseract

npm 不是 Python 包管理器,所以 tesseract 安装确实失败了。