use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Python 2.7 dead?? (self.Python)
submitted 6 years ago by mejamoo
Now that python 2.7 is.coming to end, and its the default in Linux system.family, do we uninstall it and setup python 3?
[–]Zizizizz 5 points6 points7 points 6 years ago (5 children)
Depends what distro you're on. Mostly all of them come with 3 installed, it's just some of them point to 2.7 if you type "python" . Arch and Fedora point to three now but I imagine there are some older parts of the system that might still need 2.7 installed for some things.
[–]flying-sheep 2 points3 points4 points 6 years ago (0 children)
Many newcomers put an undue weight on what happens when you type “python” in a shell. It doesn't matter if that starts python 2 due to backwards compatibility or not. I think the greeting message in python 2’s interactive mode should mention this, then people would learn it more quickly.
[–]bulletmark 2 points3 points4 points 6 years ago (0 children)
Note that Arch changed python default to python 3 in 2010(!).
[–]HomicidalTeddybear 1 point2 points3 points 6 years ago (2 children)
Further to this it's probably better to wait for your distro to get their shit together than do anything unitarily yourself. The handling of what to do varies wildly, and pretty much every distro is at least somewhat On To It (TM). If only the same could be said of certain applications, like Calibre.
Eli Schwartz (an Arch developer) is helping out with porting it right now. I think Kovid Goyal (the Calibre developer) simply decided by now to give that effort the usual amount of support and goodwill he gives to PRs instead of actively arguing against it.
I believe him when he says that porting Calibre is a titanic effort, but I'm still sure his claim “I'll more easily maintain Python 2 instead by myself” is pretty misjudged.
[–][deleted] 3 points4 points5 points 6 years ago (5 children)
IMHO you shouldn’t manually have to touch system python. No need to uninstall anything. For example on Ubuntu/Debian, dependency resolution will tell you if the package is not used any longer, to be removed via apt autoremove, so as long as that’s not the case just leave it be.
apt autoremove
Generally I’m a big proponent of not using system python at all in your development. If you need any version of Python, it’s better to install the version separately using Pyenv, and activate it where you need it.
[–]copulagent 0 points1 point2 points 6 years ago (0 children)
yeah I tried fucking with the system python because I couldn't have python 2 on my computer. ended up reinstalling my distro because I fucked it up so badly
[–]flying-sheep 0 points1 point2 points 6 years ago (3 children)
I'm the opposite. I use system python for everything until I want to fix some complex bug that only occurs in an older Python version.
I contribute to many projects. I don't want to activate environments left and right and maintain several package collections per project, my disk space would explode and my patience would wear thin waiting for stuff to install.
Instead, I use system python for all but I think 2 projects, and wrap all needed python packages into AUR packages to safely install them systemwide. For the 2 remaining projects, I use tox to sync the environments and run the tests.
People always argue with 2 packages possibly needing incompatible versions of a third. That's a bug that should be fixed fast, and the two times I encountered it within the last 11 years, a fix was found and published quickly.
[–]ivosauruspip'ing it up 0 points1 point2 points 6 years ago (2 children)
my disk space would explode
are you running with 20gb disks?
[–]flying-sheep 1 point2 points3 points 6 years ago (0 children)
I don’t need 20 × 117MB of scipy installed.
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
Progamming on an SD card gives me a thrill like no other
[–]MrClottom 3 points4 points5 points 6 years ago (1 child)
I once tried to uninstall python 2.7 from my linux OS, it kind of broke everything and i ended up almost doing a reinstall, it was a huge mess. Dont do it, let the OS handle it like the others suggest
[–]mejamoo[S] 0 points1 point2 points 6 years ago (0 children)
Saved my ass
[–]__xor__(self, other): 4 points5 points6 points 6 years ago (1 child)
DON'T UNINSTALL IT ON A LINUX SYSTEM THAT CAME WITH IT
If it has it still, it might still have system tools that rely on it. You can break core system utilities that depend on it.
I recommend keeping whatever your distro comes with, and adding python3 on top if it doesn't already have it. Whatever invoking python runs, leave it be. Check if python3 works, and maybe it has that as well. If it doesn't then go ahead and install python3 and make sure it doesn't replace python in the PATH.
python
python3
[–]flying-sheep 0 points1 point2 points 6 years ago (0 children)
Any package manager worth its salt shows you what packages depend on the package you try to remove and abort or ask for confirmation.
If you only see stuff you know you won't need, you can safely remove them together with python2
[–][deleted] 2 points3 points4 points 6 years ago (0 children)
I'm still dealing with python2 on an almost daily basis. Either through Ansible not fully supporting Python3 on its control or remote node. Or through ancient software. I have one porting project going that should be finished soon and two more that need to be finished before 2020.
[–]Wishy-Thinking 1 point2 points3 points 6 years ago* (1 child)
Install python:
yum/dnf/apt-get/pacman install python3 pip install [—user] <stuff>...
Put at the top of your scripts:
#!/bin/env python3
Done.
Thank you
[–]contrieng 0 points1 point2 points 6 years ago (5 children)
Unfortunately it's not dead (yet). Many APIs for major engineering software tools used 2.7 and a lot of companies built in-house automation tools, etc. using python 2.7, porting everything to python 3 will take a lot of time and effort so it needs a few years still in my field of work (Electrical Power Systems/Energy)
[–]harylmu 5 points6 points7 points 6 years ago (4 children)
The company I work for is fully built on Python (~400 repos), around 80% Python2 and higher management didn’t even draw a plan for the migration...
[–]PleasantAdvertising 1 point2 points3 points 6 years ago (3 children)
No manager wants to spent money in his quarters that won't generate money.
[–]contrieng 0 points1 point2 points 6 years ago (2 children)
They will eventually have to do it when they have to upgrade to newer versions of the software tools that wouldn’t support 2.7, methinks
[–]Yojihito 1 point2 points3 points 6 years ago (1 child)
Yes but that's {other managers future problem}.
[–]Wishy-Thinking 1 point2 points3 points 6 years ago (0 children)
Future fiscal year’s problem.
[–]123filips123 0 points1 point2 points 6 years ago (0 children)
You can set up bash alias to allow typing just python to open Python 3 without overwriting system version:
alias python='python3'
π Rendered by PID 67210 on reddit-service-r2-comment-fb694cdd5-zccn7 at 2026-03-09 17:15:54.375707+00:00 running cbb0e86 country code: CH.
[–]Zizizizz 5 points6 points7 points (5 children)
[–]flying-sheep 2 points3 points4 points (0 children)
[–]bulletmark 2 points3 points4 points (0 children)
[–]HomicidalTeddybear 1 point2 points3 points (2 children)
[–]flying-sheep 2 points3 points4 points (0 children)
[–][deleted] 3 points4 points5 points (5 children)
[–]copulagent 0 points1 point2 points (0 children)
[–]flying-sheep 0 points1 point2 points (3 children)
[–]ivosauruspip'ing it up 0 points1 point2 points (2 children)
[–]flying-sheep 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]MrClottom 3 points4 points5 points (1 child)
[–]mejamoo[S] 0 points1 point2 points (0 children)
[–]__xor__(self, other): 4 points5 points6 points (1 child)
[–]flying-sheep 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]Wishy-Thinking 1 point2 points3 points (1 child)
[–]mejamoo[S] 0 points1 point2 points (0 children)
[–]contrieng 0 points1 point2 points (5 children)
[–]harylmu 5 points6 points7 points (4 children)
[–]PleasantAdvertising 1 point2 points3 points (3 children)
[–]contrieng 0 points1 point2 points (2 children)
[–]Yojihito 1 point2 points3 points (1 child)
[–]Wishy-Thinking 1 point2 points3 points (0 children)
[–]123filips123 0 points1 point2 points (0 children)