1. 程式人生 > >Python 圖像識別錯誤2

Python 圖像識別錯誤2

too 啟動 原理 字符轉義 roc -1 get site 問題

發生了 WindowsError
Message=[Error 2]
StackTrace:
Popen._execute_child 中的 C:\Python27amd64\lib\subprocess.py:640
Popen.__init__ 中的 C:\Python27amd64\lib\subprocess.py:390
run_tesseract 中的 C:\Python27amd64\lib\site-packages\pytesseract\pytesseract.py:47
image_to_string 中的 C:\Python27amd64\lib\site-packages\pytesseract\pytesseract.py:123

GetImageDate.m 中的 C:\Users\Yu-we\Desktop\projects\ToolsSuite\PythonDataCatcher\ImageIdentification.py:9

按教程下載配置Path

pytesseract PIL

及安裝 Tesseract-OCR

出現以上錯誤。。

原因:啟動子進程時找不到程序文件。檢查之下,是路徑問題。路徑寫得沒有問題,但就是不對。前面加個 r

解決。

加 r 是什麽意思?

引:

在打開文件的時候open(r‘c:\....‘)

加r和不加‘‘r是有區別的

‘r‘是防止字符轉義的 如果路徑中出現‘\t‘的話 不加r的話\t就會被轉義 而加了‘r‘之後‘\t‘就能保留原有的樣子

在字符串賦值的時候 前面加‘r‘可以防止字符串在時候的時候不被轉義 原理是在轉義字符前加‘\‘

技術分享

Python 圖像識別錯誤2