logo
Loading...

pip install pytesseract出現錯誤 - Cupoy

已安裝Tesseract-OCR在c:\program files\Tesseract-OCR下, ...

pycrawler

pip install pytesseract出現錯誤

2020/01/14 下午 09:56
Python網路爬蟲討論版
董景哲
觀看數:69
回答數:3
收藏數:1
pycrawler

回答列表

  • 2020/01/15 下午 05:13
    Emma
    贊同數:1
    不贊同數:0
    留言數:0

  • 2020/01/16 下午 02:17
    張維元 (WeiYuan)
    贊同數:2
    不贊同數:0
    留言數:0

    補充一下這一段(投影片也有提到),有兩個東西要安裝:


    1. Tesseract-ORC 工具(這是裝在電腦上,跟 Python 無關的辨識工具)

    2. pytesseract (這是 Python 套件,用來在 Python 中操作 Tesseract-ORC )


    如果你是用 Windows 系統的話,可以手動指定位置:


    ```

    import pytesseract 

    pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract'

    ```

  • 2020/02/12 下午 10:24
    Jessie Chen
    贊同數:0
    不贊同數:0
    留言數:0

    我有設定第一個的路徑,但是還是會出現以下錯誤,請問是有是有甚麼問題嗎?

    OSError                                   Traceback (most recent call last)
    ~\Anaconda3\lib\site-packages\pytesseract\pytesseract.py in get_tesseract_version()
        324             subprocess.check_output(
    --> 325                 [tesseract_cmd, '--version'], stderr=subprocess.STDOUT,
        326             )

    ~\Anaconda3\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
        335     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    --> 336                **kwargs).stdout
        337 

    ~\Anaconda3\lib\subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
        402 
    --> 403     with Popen(*popenargs, **kwargs) as process:
        404         try:

    ~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
        708                                 errread, errwrite,
    --> 709                                 restore_signals, start_new_session)
        710         except:

    ~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
        996                                          os.fspath(cwd) if cwd is not None else None,
    --> 997                                          startupinfo)
        998             finally:

    OSError: [WinError 740] 要求的作業需要提升的權限。

    During handling of the above exception, another exception occurred:

    TesseractNotFoundError                    Traceback (most recent call last)
    <ipython-input-35-eb29b48b0c53> in <module>()
          1 import pytesseract
          2 pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe'
    ----> 3 code = pytesseract.image_to_data(img)
          4 print(code)

    ~\Anaconda3\lib\site-packages\pytesseract\pytesseract.py in image_to_data(image, lang, config, nice, output_type, timeout, pandas_config)
        409     """
        410 
    --> 411     if get_tesseract_version() < '3.05':
        412         raise TSVNotSupported()
        413 

    ~\Anaconda3\lib\site-packages\pytesseract\pytesseract.py in wrapper(*args, **kwargs)
        112     def wrapper(*args, **kwargs):
        113         if wrapper._result is wrapper:
    --> 114             wrapper._result = func(*args, **kwargs)
        115         return wrapper._result
        116 

    ~\Anaconda3\lib\site-packages\pytesseract\pytesseract.py in get_tesseract_version()
        330         )
        331     except OSError:
    --> 332         raise TesseractNotFoundError()
        333 
        334 

    TesseractNotFoundError: C:\Program Files (x86)\Tesseract-OCR\tesseract.exe is not installed or it's not in your path