Wolfram Research

Function Repository Resource:

PythonVersion

Source Notebook

Display the Python version installed on your machine

Contributed by: Wolfram Staff

ResourceFunction["PythonVersion"][]

gives the version of your Python package.

ResourceFunction["PythonVersion"][ExternalSessionObject[]]

gives the Python version for the specified external session.

ResourceFunction["PythonVersion"]["path"]

gives the version for the Python executable located at "path".

Details and Options

ResourceFunction["PythonVersion"][] is effectively equivalent to executing the command line python --version.

Examples

Basic Examples

Display the Python version:

In[1]:=
ResourceFunction["PythonVersion"][]
Out[1]=

Get the Python version corresponding to an ExternalSessionObject:

In[2]:=
session = StartExternalSession["Python"]
Out[2]=
In[3]:=
ResourceFunction["PythonVersion"][session]
Out[3]=
In[4]:=
DeleteObject[session]

Get the version for a specific path:

In[5]:=
path = ResourceFunction["FindPythonExecutable"][]
Out[5]=
In[6]:=
ResourceFunction["PythonVersion"][path]
Out[6]=

Resource History

Source Metadata

Related Resources

License Information