• Jobs
  • About Us
  • Jobs
    • Home
    • Jobs
    • Courses and challenges
  • Businesses
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

2.1K
Views
Is it possible to use Python 3.10 in Google Colab?

I would like to use the Structural Pattern Matching feature from Python 3.10 in Google Colab so using the commands

!sudo apt-get install python3.10
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
!sudo update-alternatives --set python3 /usr/bin/python3.10

I was able to make !python --version output 3.10.0, but the print(sys.version) still outputs 3.7.12 in code cells and so the match cases statement raises SyntaxError

number = 1

match number:
    case 0:
        print("Error")
    case _:
        print(number)

Is there any way to make this work?

over 3 years ago · Santiago Trujillo
1 answers
Answer question

0

You can try these commands:

!update-alternatives --install /usr/bin/python python /usr/bin/python3.10

then

!update-alternatives --list python

This must display your downloaded Python version.

After that,

!sudo update-alternatives --config python
## !Set python3.10 as default.

Finally,

!sudo update-alternatives --set python /usr/bin/python3.10

then check your default Python version on colab.

!python3 --version
over 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Show me some job opportunities
There's an error!