I have both Python 2 and Python 3 installed, but when I run IPython using ipython
from terminal it launches Python 2. How do I get IPython to run Python 3 instead? Within the IPython reference it says you just need to use the command ipython3
from the terminal but this doesn't work. This question seems to be asked elsewhere on Stackoverflow but I don't see a very clear answer.
Asked
Active
Viewed 2,537 times
5

dsaxton
- 995
- 2
- 10
- 23
-
1Did you install ipython3? `pip3 install ipython`? – Padraic Cunningham Aug 09 '15 at 17:53
-
If you had Python2 when you first installed `ipython` it will run using Python2 even if you install Python3 later. Maybe [this](http://stackoverflow.com/questions/9386048/ipython-reads-wrong-python-version) will help. – pushkin Aug 09 '15 at 17:53
-
Change system python environment path. – dsgdfg Aug 09 '15 at 17:56
-
@SDilmac, why would you suggest doing that? – Padraic Cunningham Aug 09 '15 at 18:04
-
@Pushkin Can I simply reinstall `ipython` then just as though I were installing it for the first time? – dsaxton Aug 09 '15 at 18:04
-
1@dsaxton, `pip3 install ipython` then simply use `ipython` or `ipython3`, there is no need to do anything else – Padraic Cunningham Aug 09 '15 at 18:04
-
@PadraicCunningham Great! It now runs Python 3 with the command `ipython3`. If you want to add that as an answer I'll accept it. This actually fixed another problem I was getting ready to ask about. – dsaxton Aug 09 '15 at 18:08
-
All app reading system parameters for working. If you got an default path py27. You need change it. @dstaxton system is py27 reinstall but still not working(if not ask user which python you want ?). – dsgdfg Aug 09 '15 at 18:11
-
@dsaxton, sure I added an answer – Padraic Cunningham Aug 09 '15 at 18:15
2 Answers
5
You need to install ipython for python3 which you can do with pip:
pip3 install ipython
Then to start an ipython2
shell just type ipython2
, for ipython3
use ipython3

Padraic Cunningham
- 176,452
- 29
- 245
- 321
-
Typing `ipython` will actually get you whichever version you installed it on most recently. – Thomas K Aug 10 '15 at 04:00
-
1
Uninstalling then reinstalling all my ipython's worked for me:
Uninstall:
brew uninstall ipython ## had a version installed w/ brew on my machine
pip2 uninstall ipython
pip3 uninstall ipython
Reinstall with pip2 and pip3:
pip2 install ipython
pip3 install ipython
Now i get that ipython2
begins version 2.7 and ipython
begins version 3.6:
mustache:~ r8t$ ipython
Python 3.6.5 (default, Apr 25 2018, 14:26:36)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: exit()
mustache:~ r8t$ ipython2
Python 2.7.15 (default, May 1 2018, 16:44:37)
Type "copyright", "credits" or "license" for more information.
IPython 5.7.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

travelingbones
- 7,919
- 6
- 36
- 43