pytesseract Windows Error 6错误的解决办法

来源:互联网 发布:全国地区数据库 编辑:程序博客网 时间:2024/05/22 00:48

错误信息:

  1. Traceback (most recent call last):  
  2.   File "D:\tests\test_pytesseract.py", line 30in <module>  
  3.     print(pytesseract.image_to_string(img))  
  4.   File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 164in image_to_string  
  5.     config=config)  
  6.   File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 95in run_tesseract  
  7.     stderr=subprocess.PIPE,  
  8.   File "C:\Python27\lib\subprocess.py", line 702in __init__  
  9.     errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr)  
  10.   File "C:\Python27\lib\subprocess.py", line 850in _get_handles  
  11.     c2pwrite = self._make_inheritable(c2pwrite)  
  12.   File "C:\Python27\lib\subprocess.py", line 884in _make_inheritable  
  13.     _subprocess.DUPLICATE_SAME_ACCESS)  
  14. WindowsError: [Error 6
解决办法:


将pytesseract的文件中:

   proc = subprocess.Popen(command,stderr=subprocess.PIPE) 

改为:

  1.  proc = subprocess.Popen(command,  
  2.             stdout=subprocess.PIPE,  
  3.             stderr=subprocess.PIPE,  
  4.             shell=True  
  5.             )  
即可。

原创粉丝点击