1

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
13
  • did you specify ipython3 to start a shell/notebook? In relation to the second part that is what happens when you install multiple interpreters. Commented Jan 17, 2015 at 16:15
  • The problem is probably because pip3 actually points to python2, remove it and reinstall using get-pip.py and the python3 interpreter Commented Jan 17, 2015 at 16:29
  • when you started an ipython3 shell previously what did you see listed as the interpreter? Also add output for which -a python and which -a python3 Commented Jan 17, 2015 at 17:40
  • 1
    yep but add which -a python3 Commented Jan 17, 2015 at 18:07
  • Did you remove the system python? Commented Jan 17, 2015 at 18:11

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

That's a fine solution, though it's unfortunate that it was necessary in the first place.
@YatharthROCK Can you explain how you did this in more detail?
@dsaxton Type nano `which ipython3` and change the first line to what is described in the answer above.
0

what work for me is changing #!/usr/bin/python to #! /usr/bin/python3 in file /usr/local/bin/ipython3

Just make sure that above address in all files coming out from 'whereis ipython3' should be same.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.