My team has simple python scripts that use use f' strings, so Python 3.6+ is required. The problem is, some people are running on older OS that have Python3.5 installed as the base Python3 interpreter and have supplementally installed 3.6 to run these scripts, and some people are running on newer ones that are using 3.7+ which run this perfectly fine.
If I put this in the .sh script
python3 myscript.py
Then on the older systems it will pick python3.5 and fail, whereas the newer ones will pick python3.7 and succeed
If we put
python3.6 myscript.py
Then on the older systems that have installed Python3.6 manually, it will work, but on the newer systems it won't find python3.6 and will fail, even though python3.7 would have been fine.
Is there a way to say "Use any version of python >= 3.6"? Yes, I realize that you can create venv and then just use python3, but we're trying to script out that part of the setup as well. For example, we might have a .whl that requires 3.6 so we do
#!/bin/sh
python3 -m venv venv
. venv/bin/activate
pip install my.whl
python3 script_that_depends_on_wheel.py
We don't want to have to have every version of Python installed on every system. For the newer systems, there's no reason for them to install Python3.6 when 3.7 works perfectly fine. We don't want to update the system interpreter to a newer version on the off chance that it could break something.