Search code examples
pythonpython-tesseract

Check pytesseract version using python


Is there a way to check pytesseract version in python?
According to PyPi documentation of pytesseract, there is a built-in function get_tesseract_version to get pytesseract version. But when I run it in python, I get the following:

>>> import pytesseract
>>> pytesseract.get_tesseract_version
<function get_tesseract_version at 0x7f4b9edd4598>
>>> print(pytesseract.get_tesseract_version)
<function get_tesseract_version at 0x7f4b9edd4598>

I know that I can get pytesseract version using pip freeze, but I want to get it using python. Is that possible?


Solution

  • You need to call the function – pytesseract.get_tesseract_version() – but that will get you the underlying Tesseract version, not the version of pytesseract in use.

    Since pytesseract doesn't unfortunately expose the standard __version__ variable, you can use the pkg_resources API to introspect the current package environment:

    >>> import pkg_resources
    >>> pkg_resources.working_set.by_key['pytesseract'].version
    '0.3.0'