【发布时间】:2019-03-18 06:58:01
【问题描述】:
所以我正在使用这里给出的 tesseract-php 包装器https://github.com/thiagoalessio/tesseract-ocr-for-php。 这是我的 php 代码的样子:
<?php
require_once "vendor/autoload.php";
use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('image1.jpeg'))->run();
?>
通过 cmd 运行时,它工作得很好。但是,在尝试在 xampp 服务器上运行时,我收到了这个错误
Fatal error: Uncaught thiagoalessio\TesseractOCR\TesseractNotFoundException:
Error! The command "tesseract" was not found. Make sure you have Tesseract
OCR installed on your system: https://github.com/tesseract-ocr/tesseract The
current $PATH is C:\ProgramData\Oracle\Java\javapath;C:\Program Files
(x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program
Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Java\jdk1.8.0_151\bin;C:\Program Files\Git\
in C:\xampp\htdocs\tesseract_project\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php on line 42
我在这里阅读了一些答案,结果发现添加它会有所帮助
$path = getenv('PATH');
putenv("PATH=$path:C:\Program Files (x86)\Tesseract-OCR");
但是,没有任何变化,我仍然遇到同样的错误。是不是我做错了什么?
【问题讨论】:
标签: php path xampp ocr tesseract