Skip to content
← Back to Community
Python 3.10 on replit
Profile icon
19ecal

Basically put this in your .replit file:

run = "(python3.10 --version || install-pkg python3.10) && clear && python3.10 main.py"

Explanation:
(python3.10 --version || install-pkg python3.10): check the version of python3.10, if it exited non-zero install it
clear && python3.10 main.py: clear the screen and run main.py

Python 3.10 is not the full release until October (currently beta), and I doubt very much that replit will add it then, so use this .replit file if you want to run the new features.

https://docs.python.org/3.10/whatsnew/3.10.html

Voters
Profile icon
juliencantau
Profile icon
plasmium
Profile icon
catornot
Profile icon
Skippy88
Profile icon
SirHacksAlot
Profile icon
AmrAwady
Profile icon
Shakir-UllahUll
Profile icon
TheNerd21
Profile icon
bitFez
Profile icon
TungNguyen67
Comments
hotnewtop
Profile icon
19ecal

UPDATED (using nix):
make a new nix repl: https://replit.com/new/nix
put this into replit.nix:

{ pkgs }: { deps = [ pkgs.python310 ]; }

put this in .replit

run = "python3.10 main.py"
Profile icon
UMARismyname

@19ecal only problem with nix repls is that pip doesn't work with 3.10. I've tried ensurepip and get-pip.py as well and it doesn't work. Only 3.8-3.9 packages are available.

Profile icon
toricane101

Does this work with external packages from PyPI (pip install ____ or Replit's packaging manager)?

Profile icon
ch1ck3n

why do you need python 3.10

Profile icon
IMayBeMe

@ch1ck3n idk, I guess it’s for people to feel like they use the latest tech hence making them a better programmer somehow. Tbh every python version is practically the same.

Profile icon
FlickerDroid

@IMayBeMe bru..., please see the python 3.10 changelogs, its got better error predictions and all

Profile icon
rejevichb

@ch1ck3n to me, the most notable item in the changelog in the OP, the language now supports pattern matching (match/case)

Profile icon
CarpalEnderman

@rejevichb This is pretty much the only reason why i want to update lol

Profile icon
TheNerd21

@CarpalEnderman same + the error matching

Profile icon
ch1ck3n

@TheNerd21 fart: a reflex that expels intestinal gas through the anus

Profile icon
teacherniels2

@ch1ck3n It has a bunch of useful features that 3.8.12 (current REPLit default) doesn't have.

Profile icon
ArshamShayan

MATCH CASE that's [email protected]