Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Are there potential problems if I update Python 2.7.5 to Python 3.x?

I'm running OS X 10.9.4 on a macbook.

It has Python 2.7.5 installed.

If I update it to the current version of Python 3, might I experience any problems?

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Are you using Python 2.7.5 for anything or is it just the system Python and you're looking to upgrade? If you get the DMG from python.org and install Python 3.4.x through that, you'll just get python3 instead of python, so the two can live peacefully side-by-side.

If you're looking at 100% replacing the system Python...that's probably not a great idea :)

To make sure I understand, if I get the DMG from python.org and install 3.4.x as you mentioned above, then I will have python and python3 installed?

Then as Stone Preston mentioned, when invoking the python command in terminal, I will use python if I want to use Python 2.x and python3 if I want to use Python 3.x. Is this correct?

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Yeah, that's how it worked when I tested it. I personally use pyenv but that's beyond the scope of explaining in a forum post (and because I often need to test against several versions of Python).

What I did because I wanted 3.4 as python was this.

cd  /usr/bin
sudo mv python python.orig
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 python

This gives me python3.4 as python and I can still invoke older versions of python with python2.7

Stone Preston
Stone Preston
42,016 Points

multiple python versions can coexist. Since 2.7.5 is likely the default used by the system, I probably wouldnt uninstall it. I would just install 3 alongside it and you should be fine. when invoking the python command in terminal you will just need to specify which version you want to use, so python3 should be the new version