Anaconda安装OCR——Python tesseract is not installed or it’s not in your path

未安装OCR使用 pytesseract.image_to_string() 函数时,会报错:

Python tesseract is not installed or it’s not in your path

下面说一下安装过程:
首先下载Tesseract-OCR
在这里插入图片描述
然后双击,接下来点击Next->Next->Next->Next
接下来找到安装的路径
Anaconda安装OCR——Python tesseract is not installed or it’s not in your path_第1张图片
路径可以自己定,需要记住,一会还要用,比如我的路径为:

'C:/Users/18256/.conda/envs/Xgboost/Lib/site-packages/Tesseract-OCR/tesseract.exe‘

然后安装好了先放一边。

下面打开命令行
输入:pip install pytesseract
Anaconda安装OCR——Python tesseract is not installed or it’s not in your path_第2张图片
因为我这是已经安装好了,所以和第一次安装时候显示的不一样,记住文件的位置。
根据文件的位置找到pytesseract.py文件
Anaconda安装OCR——Python tesseract is not installed or it’s not in your path_第3张图片
打开pytesseract.py
找到tesseract,把刚才复制的tesseract路径修改到此处
Anaconda安装OCR——Python tesseract is not installed or it’s not in your path_第4张图片
比如我的可以直接修改成
‘C:/Users/18256/.conda/envs/Xgboost/Lib/site-packages/Tesseract-OCR/tesseract.exe’
修改完毕,保存后重启python,即可使用。

你可能感兴趣的:(机器学习)