Some Python packages provide a way for a program to get the installed version. E.g.
>>> import numpy
>>> numpy.version.version
'1.5.0'
But I can't find a way to do so for pywin32
. What good way might there be to find out?
I found a blog post "Include version information in your Python packages" by Jean-Paul Calderone which showed you can get the version of pywin32
this way:
>>> import win32api
>>> fixed_file_info = win32api.GetFileVersionInfo(win32api.__file__, '\\')
>>> fixed_file_info['FileVersionLS'] >> 16
212
Adapted from Mark's official response at: http://mail.python.org/pipermail/python-win32/2010-April/010404.html
import os
import distutils.sysconfig
pth = distutils.sysconfig.get_python_lib(plat_specific=1)
ver = open(os.path.join(pth, "pywin32.version.txt")).read().strip()
as Craig's answer no longer worked for me on the amd64 build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With