making python3 my default
I'm finally there. After a long time of writing books using Python 3, and teaching in Python 3 on a daily basis, I'm finally at the point where I'm changing my work environment to use Python 3 by default.
Here are the signs that convinced me it was time:
- The release of Pillow to provide PIL functionality!
- Django 1.5
- IPython and IPython notebook are fully supported -- I Love IPython Notebook
- matplotlib !!
- Sphinx, Jinja, SQLAlchemy, and many others are supported. See: https://python3wos.appspot.com/
There are a couple of projects that I use a lot that are not yet on Python3 (web2py) but I'm not going to let that stop me.
It turns out to be pretty easy to get yourself up and running on all of this stuff with Python 3. I'm on a Mac running 10.8.3. The first and most important step is to get a working version of pip for Python3. First you need to install distribute.
sudo python3 distribute_setup.py
This will install easy_install in your Python home, but go one more step and install pip.
sudo python3 get-pip.py
This will create a pip in your /Library/Frameworks/Python.framework/Versions/3.3/bin directory.
From there you can begin pip installing pretty much everything you need!
From my history today as I was setting everything up:
10393* pip3 install ipython
10409* pip3 install numpy
10410* pip3 install matplotlib
10429* pip3 install tornado
10430* pip3 install pyzmq
10455 pip3 install Sphinx
If you are on a Mac you will need to use easy_install to install one thing, for IPython. For some reason pip installing the readline library puts it too late in the load path to work with IPython, so you need to use easy_install-3.3 readline to get the history in IPython working just right.
Finally, you will want to add the Python 3 bin directory to your PATH. Edit your .bashrc or .zshenv file. Note that the following puts the Python 3 bin directory at the front of your PATH, making it the default when you type pip, python, or ipython. If you need to revert back to python2.7 for some task you will need to be explicit about it.
Easy! You were expecting this to be a long and arduous process fraught with hacks and silly edits to config files. Nope, just a few basic commands. I take this as the final sign that Python 3 is here and ready to be your day to day Python.