Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can't use Python 3.10
#4
try to find installed python3 versions

from subprocess import check_output
import sys

# find all installed python3 versions
python_version = ""
python_versions_list = []
versions = check_output("which -a python3", shell=True).decode()
versions_list = versions.splitlines()

for v in versions_list:
    version = check_output(f"{v} --version", shell=True).decode().rpartition(".")[0].split(" ")[1]
    python_versions_list.append(version)
    print(f"found python{version}")

python_version = f'python{sys.version.split(" ")[0].rpartition(".")[0]}'

print("default python3 version:", python_version)
Reply


Messages In This Thread
I can't use Python 3.10 - by Reikurooo - Feb-20-2022, 07:49 PM
RE: I can't use Python 3.10 - by deanhystad - Feb-20-2022, 09:31 PM
RE: I can't use Python 3.10 - by Reikurooo - Feb-22-2022, 03:09 PM
RE: I can't use Python 3.10 - by Larz60+ - Feb-21-2022, 09:33 AM
RE: I can't use Python 3.10 - by Axel_Erfurt - Feb-21-2022, 12:29 PM
RE: I can't use Python 3.10 - by Reikurooo - Feb-22-2022, 03:13 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020