Check Pytesseract Version Using Python

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?

3 Answers

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'
1

Just add the function parenthesis and you should get the output:

pytesseract.get_tesseract_version() 
5.0.0-alpha.20200328
1

If you are working with pip, simply type the following command inside your environment:

pip freeze

All installed packages (in that environment) and their corresponding versions will be listed:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.