(There is a similar question, so I intended to provide more information below that one but got my post deleted. So I'll ask my own question here.)
I installed the newest version of iPython by typing
sudo -H pip install ipython
I confirmed the installed version is 3.1.0
> pip show ipython
---
Metadata-Version: 2.0
Name: ipython
Version: 3.1.0
Summary: IPython: Productive Interactive Computing
Home-page: http://ipython.org
Author: The IPython Development Team
Author-email: ipython-dev@scipy.org
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires:
However, when I type ipython
command and enter the program, the message is:
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- 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.
The only way the IPython 3.1.0 can be called is to type ipython
in the directory /usr/local/lib/python2.7/dist-packages
where pip installed it.
By comparing the help file in iPython, I confirmed they are indeed different versions (so not just displaying wrong version).
Typing which ipython
would give /usr/local/bin/ipython
, whose content is
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from IPython import start_ipython
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(start_ipython())
Weirdly, when I use pip uninstall ipython
to remove ipython 3.1.0, the old 1.2.1 version (which I assume came with the system and caused the confusion) also disappeared.