0

I tried the below code in Anaconda Prompt

import <module name>
print(<module name>.__version__)
print(<module name>.version.VERSION)
print(<module name>.version)

but get AttributeError: 'module' object has no attribute 'version' for each print.

Is it be'cos datetime, math, win32com.client are in-built library in Python? So how do I find their version?

Thank you

Peter
  • 353
  • 3
  • 10
  • Does this answer your question? [Finding the Specific Version of Python's Math and CMath Modules](https://stackoverflow.com/questions/42866483/finding-the-specific-version-of-pythons-math-and-cmath-modules) – leaves Sep 06 '21 at 04:01
  • You can use python version instead of those library version – Sabil Sep 06 '21 at 04:05
  • @leaves: I just found out win32com is not in-built library with Python. So how can I find its version? Thanks! – Peter Sep 06 '21 at 06:50

1 Answers1

1

You can find the version of these modules in the Python3.x/Lib/__pycache__ folder. As mentioned in the docs the version is available in this format module.version.pyc

Example: datetime.cpython-39.pyc means version 3.9

In fact, the version of the built-in modules is the same as the version of python.

Nima
  • 404
  • 3
  • 14
  • I just found out win32com is not in-built library with Python. So how can I find its version? Thanks! – Peter Sep 06 '21 at 06:51
  • In the cmd ```pip list``` and find _pywin32 301_. **301** is the version. – Nima Sep 06 '21 at 08:05
  • Thanks for the reply. But why is pywin32 version the same as win32com? – Peter Sep 06 '21 at 09:28
  • Because it is part of pywin32. As you can see in the GitHub repo of [pywin32](https://github.com/mhammond/pywin32/tree/master/com/win32com) – Nima Sep 06 '21 at 10:02