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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With