错误信息:
- Traceback (most recent call last):
- File "D:\tests\test_pytesseract.py", line 30, in <module>
- print(pytesseract.image_to_string(img))
- File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 164, in image_to_string
- config=config)
- File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 95, in run_tesseract
- stderr=subprocess.PIPE,
- File "C:\Python27\lib\subprocess.py", line 702, in __init__
- errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr)
- File "C:\Python27\lib\subprocess.py", line 850, in _get_handles
- c2pwrite = self._make_inheritable(c2pwrite)
- File "C:\Python27\lib\subprocess.py", line 884, in _make_inheritable
- _subprocess.DUPLICATE_SAME_ACCESS)
- WindowsError: [Error 6]
将pytesseract的文件中:
proc = subprocess.Popen(command,stderr=subprocess.PIPE)
改为:
- proc = subprocess.Popen(command,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- shell=True
- )