YatharthROCK YatharthROCK - 4 months ago 29
Python Question

iPython 3 uses Python 2 instead of Python 3

iPython 3 — installed with

pip3
and located at
/usr/local/bin/ipython3
— 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
/usr/local/bin/python

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

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

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

$ ipython3 -V
2.3.1

Answer

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.