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 Setting Up a Local Python Environment Installing Python and Python Libraries Locally Using virtualenv

S B
S B
4,497 Points

Setting up two virtual environments with two different versions of python (MAC)

I have followed the steps in this video, and the virtual environment with python 3.X (the latest version on the website is installed). I'm trying to setup another virtual environment with python 2.7. How would I go about doing this? Can someone please give me step by step instructions?

Thanks!

1 Answer

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

When you create the virtualenv, you can pass in the --python argument which points to the Python interpreter you want to use.

For example, if you have Python 2 installed as /usr/bin/python, you should be able to do virtualenv py2_venv --python=/usr/bin/python.