Some new Mac notes concerning Python. Out of the box the Mac has Python and when I ran pip list
I saw a bunch of stuff that I didn't recognize. When I tried to remove things they looked baked in because they were installed as root
.
Turns out you can ignore all that. Just install a new Python using brew
.
$ brew install python
This gives you a new Python called Python2. That's not that helpful because who wants to remember to always use Python2?
One avenue which you'll be going down at some point is to use a virtual environment for all your projects. For that install virtualenv
.
$ pip2 install virtualenv
Not the pip2. This is the version of pip installed along with your Python2. Odd, yes and not remember-able just like Python2 but that's probably the last time you need to remember.
For each project you have create a virtualenv using the following from your project's root.
$ virtualenv env
$ source ./env/bin/activate
You'll notice that in your virtual environment you'll have a Python called Python that is really the version you installed with brew. The Python2 is Python in your environment.
So far so good.
Next up is Python3