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 Installing Python 3 on Mac OS X

What path do you get when you run `which python3`?

$ which python3
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
$ which python
/usr/local/bin/python

Is this correct? I feel like both Python 2 and 3 should be in /usr/local/bin.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

Yes and no. which shows where along your PATH has the first occurrence of python3.

Depending on how Python 3 was installed or if a virtual environment is active, the PATH can be altered to put a different directory earlier in the PATH. This affects what which returns.

Do you see python3 in the /use/local/bin directory?

How was python3 installed?

Python3 showed up in /Library/Frameworks/Python.framework/Versions/3.5/bin so I switched up my PATH to have /usr/local/bin appear first, now it appears there.

I pip installed flake8 and it wasn't executable so I added /Library/Frameworks/Python.framework/Versions/3.5/bin/flake8 to the PATH. Now it is executable. Is this the correct usage for global packages (I know virtualenv's are better for local packages) or should I expect flake8 to show up somewhere else?

TBH, I forget how I installed Python 3. Either by Homebrew or the Python.org download package or both... There is so much dev junk on this Mac from working in various environments.