Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
2

How to use Python 2.7 in replit?

JWZ6
JWZ6

Like, I know that Python 2.7 is old, but I do want to learn it. Can anyone help me create a Python 2.7 repl?

2 years ago
Answered by SamDev7View Answer
You are viewing a single comment. View All
2
IndyRishi
IndyRishi

@JWZ6
Create a nix repl. Go to README.md. Do ctrl+a then paste this:
{ pkgs }: {
deps = [
pkgs.pypy
];
}
Create a new python file. Name it something other than main.py.
Create a file called .replit. Type run = "pypy BLANK.py". Replace BLANK with the name of your python file.
After that, go to the three dots next to create a folder and click show config files.
Go to replit.nix. Replace anything there with this:
{ pkgs }: {
deps = [
pkgs.pypy
];
}
Then write your python 2.7 code in your python file. It should work! If you want to change it to Python 3, go to anywhere that says pkgs.pypy and replace it with pkgs.pypy3. Thanks! If this works please mark it as answered. Thank you!

EDIT: For the "pkgs" thing indent deps once and pkgs.pypy twice. Indent the ]; once and everything else no times.

1 year ago