Python

Documentation

universions.python.get_python_version(path: Union[pathlib.Path, str, None] = None) → Optional[universions.version.Version]

Get the Python version.

Parameters:path – The path to the Python to check. If not defined, it uses “python”
Returns:The Python version.

Python example

>>> from universions.python import get_python_version
>>> get_python_version()
Version(major=3, minor=7, patch=5, prerelease='rc1', build=None)

CLI example

>>> universions python
3.7