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 Python Collections (Retired) Lists Redux Shopping List Take Three

Dennis Le
Dennis Le
12,872 Points

Switching python2 to python3

Is there a way to use different versions of python? Have different python version ready to use...For example, if i need python 2.7 for one project and the next day I need python 3.5 for another project. Can I switch the version using just using the terminal...not sure on really how to ask this question...basically, I want to switch back and forth

2 Answers

Jorge Gimeno
Jorge Gimeno
5,956 Points

Look at a package called virtualenv. It allows you to set up separate "virtual enviroments" with their own Python interpreter and downloaded packages. Really handy when working on projects that use different versions of Python.

"python2 my_version2_program.py" to run python version 2. "python3 my_version3_program.py" to run python version 3.