【发布时间】:2018-04-14 08:13:34
【问题描述】:
问题
emacs python 解释器找不到我的 tesseract (tesserocr),但我可以在终端以及我的 Spyder 安装中使用 tesseract。 Emacs python 解释器能够导入 pytesseract,但找不到 tesserocr。我收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/eghx/agent18/project-gym/tests/thresholding.py", line 34, in image_to_string2
print(image_to_string(img_open))
File "/home/eghx/anaconda3/lib/python3.6/site-packages/pytesseract-0.1.7-py3.6.egg/pytesseract/pytesseract.py", line 122, in image_to_string
File "/home/eghx/anaconda3/lib/python3.6/site-packages/pytesseract-0.1.7-py3.6.egg/pytesseract/pytesseract.py", line 46, in run_tesseract
File "/home/eghx/anaconda3/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/home/eghx/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'tesseract': 'tesseract'
当我跑步时
pytesseract.image_to_string(img)
但是,当我从终端而不是桌面打开 EMACS 时,我没有收到此错误。似乎在 emacs 的桌面版本和终端版本中,path 变量的继承方式不同。奇怪!
说明
我这里有anaconda安装:/path/to/anaconda3
我已将此行添加到我的 init 文件中以运行此特定的 python 安装
(setq python-shell-interpreter "/path/to/anaconda3/bin/python")
我使用 conda install 安装了 pytesseract 和 tesserocr
which tesseract 给出:
/path/to/anaconda3/bin/tesseract
$ echo $PATH 给出:
/path/to/anaconda3/bin:/usr/local/sbin:/usr/lo....
我做了什么
我将 sys.path 从正常工作的 Spyder IDE 复制到 emacs python 解释器,但仍然无法正常工作。
我环顾四周,发现 this 但最佳答案与我的情况无关,因为我的 $PATH 变量包含必要的路径。
有人可以指导我吗?我是菜鸟。我有 emacs 27 和 ubuntu 16 和 conda 4.5.0。
【问题讨论】:
标签: python emacs anaconda tesseract python-tesseract