Running specific python version with same command across platforms?

Hey there!

Currently I am working on a cross-platform library written in C. It uses a python3 based build-system.

When building my project I need to call python differently depending on the platform. For instance on the unixoid systems (i.e. Linux and macOS) I need to call python3 On windows, however, I need to call python

Currently I am handling this with an ‘if’ in my workflow, which works just fine.

Still, is there a more elegant way to handle this?



Apparently I was searching using the wrong words.

1 Like


According to the docs about setup-python V2, and the docs about Using Python with GitHub Actions that you have mentioned, you do not need to use different python commands (python and python3) in different platforms now.
No matter what OS (Windows, Linux or macOS) you are on, you just need to use the setup-python V2 to install the specified version of Python, then directly run “python” command.