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

Voters

Comments

TopNew
2
SamDev7
SamDev7

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

2 years ago
1
JWZ6
JWZ6

@Saml2020
mk

2 years ago
1
RowanAckerman
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.

1 year ago
1
LoganPrattCoding
LoganPrattCoding

@Saml2020
that actually DOSEN'T WORK

1 year ago
2
SamDev7
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.

1 year ago
1
OldWizard209
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

2 years ago
2
JWZ6
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.

2 years ago
1
SixBeeps
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.

2 years ago
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
1
JWZ6
JWZ6

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

1 year ago
1
IndyRishi
IndyRishi

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

1 year ago
1
IndyRishi
IndyRishi

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

1 year ago
1
JWZ6
JWZ6

@IndyRishi
its not possible.

1 year ago
Load more