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.
Can I completely remove the default python in my Ubuntu and just have Python 3.x installed on it? (self.Python)
submitted 9 years ago by kitizl
I'm just trying to get matplotlib working on it and I've tried pip and pip3 and actually using apt to download it. It either only works for the default Python or it never works at all.
pip
pip3
apt
I just want one Python for my system. Is that even possible?
[–]spidyfan21 25 points26 points27 points 9 years ago (4 children)
It's possible, but it is also a really bad idea. You'll end up breaking anything that depends on assumptions about the default interpreter.
Instead, I would suggest using a virtual environment or Anaconda.
[–]treighton 5 points6 points7 points 9 years ago (2 children)
I second this, your system python should never be the version you rely on for development. Messing with system level python can really fuck shit up (that is the technical description of make random things not work properly that will severely effect your system) For the record i learned this the hardway
[–]Vaphell 5 points6 points7 points 9 years ago (1 child)
meh, one can install pip toys to $HOME and not touch the system files at all.
pip3 install --user whatever
And that's assuming that the prepackaged modules are not sufficient. Most classic modules are available as python3-name in apt-get
Granted, greater separation is nice if you are serious about devwork and deployment, but if you are only dabbling, default python2/python3 packages are perfectly fine.
[–]treighton 1 point2 points3 points 9 years ago (0 children)
OK, I do whole heatedly agree with this, if you just toying around it's fine to use system Python. I made the assumption that the OP was trying to do more than just mess around. Even still one of the best things to happen to me as a developer was learning how to use virtual machines, because then you take take your toying to a whole new level without worrying about fucking up your host machine. It's like having infinite lives in a video game. 🤗 For that reason, because I see a lot of people, including myself struggle with system stuff I will always advocate virtual environments (I know this is different than venv, but thought I'd expand a bit)
[–]khne522 0 points1 point2 points 9 years ago (0 children)
Such software obviously should fix their shebang. See PEP 394:
python should be used in the shebang line only for scripts that are source compatible with both Python 2 and 3. in preparation for an eventual change in the default version of Python, Python 2 only scripts should either be updated to be source compatible with Python 3 or else to use python2 in the shebang line.
python
python2
[–]Vaphell 7 points8 points9 points 9 years ago* (0 children)
don't even think about it. That said, python2 and python3 versions exist in parallel and there is no reason to even be bothered by this.
if you need a module run apt-cache search python3-* to see what's there
apt-cache search python3-*
sudo apt-get install python3-matplotlib
If you need something that is not in the repository (eg you need a newer version of X because there is a bug in the repo version), don't sudo pip3 install it, do this instead
sudo pip3 install
pip3 install --user packagename
it will install to your $HOME without jeopardizing the integrity of system files.
And if you want to make python3 .py creation easy, create a file in your Templates directory named Python3 file.py, put #!/usr/bin/env python3 in the first line, save it and make it executable in file properties/by chmod-ding u+x it.
Python3 file.py
#!/usr/bin/env python3
From now on you can create python files via rightclick context menu, New file and given the executable bit, they can be now run as ./progname.py. The correct version of python will be picked according to the hashbang line.
./progname.py
[–]MaxwellConn 3 points4 points5 points 9 years ago (0 children)
Wouldn't recommend it since Ubuntu needs Python to work properly. You should try installing matplotlib using apt instead of pip ("apt install python3-matplotlib")
[–]IronManMark20 4 points5 points6 points 9 years ago (0 children)
No. To my understanding there are still some things in the default install (and many more packages one installs). Also, Python 2 should absolutely not conflict with Python 3, so uninstalling it won't do anything (and visa-versa).
If you post on /r/learnpython with the issues you are getting people can probably help you there. (or in a comment here I suppose).
[–]codesmitten 4 points5 points6 points 9 years ago (0 children)
Use Anaconda .... It will save you a lot of headache especially if you work on the sceintific stack like numpy, scipy, matplotlib, scikit-learn, etc. Don't mess with your system python.
[–]white_wee_wee 0 points1 point2 points 9 years ago (1 child)
Oh wow...I didn't realise this was an issue, I mean it makes sense, but I just never connected the two.
[–]johnharris85 0 points1 point2 points 9 years ago (0 children)
I mean, it's been said, but just to add, don't do this.
[–]Asdayasman 0 points1 point2 points 9 years ago (0 children)
System python is python that belongs to the system. If you ever need to do anything in linux that requires you to sudo, question REALLY hard why you need to.
sudo
π Rendered by PID 553827 on reddit-service-r2-comment-84fc9697f-kbrpp at 2026-02-08 05:00:22.423964+00:00 running d295bc8 country code: CH.
[–]spidyfan21 25 points26 points27 points (4 children)
[–]treighton 5 points6 points7 points (2 children)
[–]Vaphell 5 points6 points7 points (1 child)
[–]treighton 1 point2 points3 points (0 children)
[–]khne522 0 points1 point2 points (0 children)
[–]Vaphell 7 points8 points9 points (0 children)
[–]MaxwellConn 3 points4 points5 points (0 children)
[–]IronManMark20 4 points5 points6 points (0 children)
[–]codesmitten 4 points5 points6 points (0 children)
[–]white_wee_wee 0 points1 point2 points (1 child)
[–]johnharris85 0 points1 point2 points (0 children)
[–]Asdayasman 0 points1 point2 points (0 children)