SIGN IN SIGN UP

CMake Use python instead of python3 when in a (non-base) conda environment (#2687)

Summary:
When building inside a conda environment (the recommended configuration), we should use 'python' instead of 'python3'. In some environments (mac), 'python3' may resolve to the incorrect python binary. This change maintains backwards compatibility for non-conda users by still defaulting to python3.

Note that pytorch core appears to default to 'python', instead of 'python3', so we may want to look at doing so in the future.

Bypassing unrelated lint (fix already in progress).
bypass-github-export-checks
bypass-github-executorch-ci-checks

Pull Request resolved: https://github.com/pytorch/executorch/pull/2687

Test Plan:
On both Linux and Mac, I performed the following:
Built in non-base conda environment, Checked build log to ensure it uses 'python'.
Built in base conda environment. Checked build log to ensure it uses 'python3'.
Built in non-conda environment. Checked build log to ensure it uses 'python3'.

Reviewed By: mcr229

Differential Revision: D55370314

Pulled By: GregoryComer

fbshipit-source-id: 281bafa78f6523d7c03b8a736134f18bd6cea45b
G
Gregory Comer committed
cf839648dc81f2c6ab7bad6e03790cda03fe24da
Parent: 456dab5
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 3/27/2024, 6:35:25 PM