Skip to content
Sign upLog in
← Back to Community

How to use Python 2.7 in replit?

Profile icon
JWZ6Hacker

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?

Answered by SamDev7 [earned 5 cycles]
View Answer
Voters
Profile icon
ddotb
Profile icon
JWZ6
Comments
hotnewtop
Profile icon
SamDev7

To create a new Python 2.7 repl. Use https://replit.com/new/python

Profile icon
JWZ6

@Saml2020
mk

Profile icon
RowanAckerman

@Saml2020

This no longer works. It simply takes you the the new repl page. Searching gives only Python, which is 3.8. repl.it must have removed it in the last two months.

Profile icon
LoganPrattCoding

@Saml2020
that actually DOSEN'T WORK

Profile icon
SamDev7

@Saml2020
UPDATE
Seems like replit has updated and it does not work anymore.
You will still be able to install py 2.7 with nix repls.

Profile icon
EricLi28
Profile icon
JWZ6

pls

Profile icon
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.

Profile icon
JWZ6

@IndyRishi
thx i dont think I can mark ur answer, i already marked the answer

Profile icon
IndyRishi

@JWZ6
Your welcome! If it works can you mark me as answered? It's appreciated.

Profile icon
IndyRishi

@JWZ6
Ok. Is it possible to mark it unanswered? If not its fine.

Profile icon
JWZ6

@IndyRishi
its not possible.

Profile icon
JWZ6

thx tho

@IndyRishi

Profile icon
IndyRishi

@JWZ6
Ok

Profile icon
OldWizard209

Python 2.7 was deprecated on January 1 of 2020. Why learn it? Honestly, there is no use because Python 3 has all the functionality Python2 had and much more. Just look at the maintenance status for Python 2:

image

Profile icon
JWZ6

@OldWizard209
my father has a big book on python 2.7. It's different from python 3, so I do want to give it a try.

Profile icon
SixBeeps

There's an implementation of Python 2.7 called pypy on the Nix Package Manager if you absolutely need it. Just set up Nix in a Repl and install it.