YatharthROCK YatharthROCK - 1 year ago 60
Python Question

iPython 3 uses Python 2 instead of Python 3

iPython 3 — installed with

and located at
— runs with Python 2.7.6 in both the console and notebook whereas I want it to run with Python 3 as it should.

This used to work fine before, but I may have reinstalled stuff using MacPorts or HomeBrew that triggered the change.

$ which -a python
/opt/local/bin/python # 2.7.9
/usr/local/bin/python # 2.7.8

$ which -a python2
/usr/local/bin/python2 # 2.7.8

$ which -a python3
/usr/local/bin/python3 # 3.2.4

$ pip3 -V
pip 1.5.6 from /usr/local/lib/python3.4/site-packages (python 3.4)

$ ipython3 -V

Answer Source

I edited the shebang on the iPython executable from #!/usr/bin/python to #/usr/local/bin/python3, but I am not sure if this is a hacky or bad solution.