# Universal way of checking if Python3 is set regardless of module used to do so

**URL:** https://discourse.cmake.org/t/universal-way-of-checking-if-python3-is-set-regardless-of-module-used-to-do-so/2444
**Category:** Usage
**Created:** [December 29, 2020, 8:55pm UTC](https://discourse.cmake.org/t/universal-way-of-checking-if-python3-is-set-regardless-of-module-used-to-do-so/2444 "2020-12-29T20:55:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![eriols](https://discourse.cmake.org/user_avatar/discourse.cmake.org/eriols/32/945_2.png) [@eriols](https://discourse.cmake.org/u/eriols)
#### Post date: [December 29, 2020, 8:55pm UTC](https://discourse.cmake.org/t/universal-way-of-checking-if-python3-is-set-regardless-of-module-used-to-do-so/2444/1 "2020-12-29T20:55:05Z")

</div>

In the usecase where my repo is a subrepo of someone else they might have set Python3 upstream using FindPythonInterp, FindPython or FindPython3 (maybe there are more ways even?). In such cases I want to point that executable to an internal variable to be used for my Python3 needs.  
Is there a universal way of checking these without looping through all three and see if eg `PYTHON_VERSION_MAJOR`, `Python_VERSION_MAJOR` or `Python3_VERSION_MAJOR` has been set without looping through all three of them (and then setting their respective `_EXECUTABLE` to my aforementioned variable)?  
Thanks a lot.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [December 30, 2020, 4:09pm UTC](https://discourse.cmake.org/t/universal-way-of-checking-if-python3-is-set-regardless-of-module-used-to-do-so/2444/2 "2020-12-30T16:09:37Z")

</div>

I don’t think there’s a way to do that right now. I would recommend you ignore PythonInterp and push projects to stop using it (document that if they don’t, they can add a `set(Python3_VERSION_MAJOR)` variable to bridge the gap for your project. `FindPythonInterp` is just not the way any “find python” infrastructure should have worked.

Cc: @marc.chevrier

---

<div class="post-metadata">

### Author: ![eriols](https://discourse.cmake.org/user_avatar/discourse.cmake.org/eriols/32/945_2.png) [@eriols](https://discourse.cmake.org/u/eriols)
#### Post date: [December 30, 2020, 5:38pm UTC](https://discourse.cmake.org/t/universal-way-of-checking-if-python3-is-set-regardless-of-module-used-to-do-so/2444/3 "2020-12-30T17:38:13Z")

</div>

Thanks, yes that sounds like the most sensible option.
