【问题标题】:how to get full path of python package after installation [duplicate]安装后如何获取python包的完整路径[重复]
【发布时间】:2021-09-23 18:44:28
【问题描述】:

所以我是编程的初学者。我正在尝试将 jpeg 文件转换为 atext 文件但无法这样做。我收到错误

try:
    from PIL import Image
except ImportError:
    import Image
import pytesseract
print(pytesseract.image_to_string(Image.open('A_1.jpg')))

我浏览了文档,找到了错误的原因和解决方法:

'If you don't have tesseract executable in your PATH, include the following:
pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'
# Example tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract'

所以根据文档,我应该包含已安装的可执行文件的完整路径,但我不知道如何获取路径,我正在使用 linux 并且是 linux 新手。请您帮忙

【问题讨论】:

    标签: image-processing tesseract data-conversion


    【解决方案1】:

    安装后如何获取python包的完整路径?

    要查找 python 包的路径,您可以这样做

    import pytesseract
    print(pytesseract.__file__)
    

    打印类似的东西

    \WPy64-3880\python-3.8.8.amd64\lib\site-packages\pytesseract\__init__.py
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-21
      • 2017-04-17
      • 2018-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-08
      • 2012-12-29
      相关资源
      最近更新 更多