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

I am running python 2.x. What is the best way to install python 3.x?

There are a lot of ideas on this topic and no clear solution.

Is there a simple command line step through that will clearly show how to install a virtual machine that will in the end create to folders on my machine one for python2x and one for python 3x. I would like to do this right the first time. Thanks for all your help.

2 Answers

Hey,

If you are on windows will do mac next. In windows when you install Python 2.x it creates a folder on the c drive. The folder is called Python27 or Python25 depends on your version. When I go to install Python 3 it's just as simple as 2.x Since Python three installs into the C drive. It creates it's own folder for it's version. Python34 or Python35 depending on your version. So I will have Python 2.7 and Python 3.5 both on the C drive.

These two versions will not effect one another. They are contained in different folders that are created at install time. If you want to use one vs the other. Just launch the Python executable from either Python2.x or the Python3.5. That's pretty much it.

On MAC Python installs into the usr/local/bin directory. Same principal as before apply's here. When you install Python 2.7. You will have an executable called python2.7. If you install Python 3.5 they coexist. It just also puts a python3.5 executable in the same place as the 2.7 and you you run one or the other for you programs.

There isn't really a "right" way or really even a better way to install python. You can have as many versions you want installed. You can install them wherever you want to. If there was a best way it would be to just install them via the installers. That's it.

Let me know if this helps?

This is clear. Thank you for this comment. I know have direction and a better understanding of this process.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,468 Points

Once you have multiple versions of pip installed it is easy to switch between which is the active by using virtualenv. There is also virtualenvwrapper which adds a convenient layer of organization on top of vitualenv

I'd suggest running both Python 2.X and Python 3.X in virtual machines. This way, you can have them both installed at the same time and they won't interact with one another.

This also adds very important to this question. Thank you.

Running Python 2.x and 3.x will not interfere with one another as it is. Having 2 VM's just to run two different versions of Python is a bit extreme.

I think two vm's is an idea, just not so sure it's viable for everyone. With two vm's it's virtualbox and getting iso's and creating images with port forwarding etc etc. Not to mention hard to manage two vm's. Performance prolly wont be there either.

I don't think it's really even a good recommendation when comparing it to the alternative of just installing them both. Simple fast and easy. But to each their own right, not trying to be conflicting.

Now if it's linux or mac you have a third options which is Virtual Environments which are not virtual machines. They are like a tiny hard drive that you can turn on and off. They are separate from one another too. Create two and put python in one and the other in the other lol. I used to use this when there were multiple developers who had their own libraries and packages could be maintain by them and separate from everything else.

All in all just my two cents.