Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can't use Python 3.10
#1
Exclamation 
Hello! I hope that I'm writing in the right category.

I want to use the 3.10 version for a script, but I'm struggling to use this version. I installed it, but when I type python --version it gives me the 3.9.10 version only.

What can I do to use the 3.10?
Reply
#2
python --version will list the version of python runs when you type "python". This may not be the most recent version.

What is printed if you type this in a shell:
Output:
py --list
Does it show -3.10 as well as 3.9.10?

Are you running in a virtual environment?

Are you on Linux, Mac or Windows?
Reply
#3
python version was 3.1, not 3.1.0 released on 13 February 2009
sane with 3.2 which was released on 20 February 2011

versions beginning with 3.0.0 contained the third division

see: https://www.python.org/doc/versions/


EDIT:
Sorry, you asked about 3.10. I misread.

Reply
#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
#5
(Feb-20-2022, 09:31 PM)deanhystad Wrote: python --version will list the version of python runs when you type "python". This may not be the most recent version.

What is printed if you type this in a shell:
Output:
py --list
Does it show -3.10 as well as 3.9.10?

Are you running in a virtual environment?

Are you on Linux, Mac or Windows?

Hello! I'm on Mac and I don't use a virtual environment. When I type your command in the terminal, it gives me zsh: command not found: py
Reply
#6
(Feb-21-2022, 12:29 PM)Axel_Erfurt Wrote: 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)

There is the result: Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Reply


Forum Jump:

User Panel Messages

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