- Operating system: Mac10.11.5
- python2.7.13
- python3.6.1
Install Python2:
Install python
Install Python3:
Install Python3
At this point, the command line input Python3 opens the Python3, and the input Python opens the Python2.
Installing Ipython with PIP
sudo Install Ipython sudo Install Ipython
Install Ipython with PIP is installed in the Python2 site-packages , the same PIP3 is installed in Python3 site-packages.
Enter the /usr/local/bin directory, you can see the ipython file, open with VI:
sudo VI Ipython
#!/usr/local/opt/python/bin/python2.7#-*-coding:utf-8-*-ImportReImportSYS fromIPythonImportStart_ipythonif __name__=='__main__': sys.argv[0]= Re.sub (r'(-script\.pyw?| \.exe)? $',"', sys.argv[0]) Sys.exit (Start_ipython ())
#!/usr/local/opt/python/bin/python2.7 This directory is the version that points to Python,
For example I want to be directed into Python3 can modify the #!/usr/local/opt/python3/bin/python3.6
So ipython this command open Ipython the Python version pointed to is Python3. For convenience we can copy this file for Ipython3, ipython3 This command file point to Python3 version, so in the terminal input Ipython Open is python2, input Ipython3 Open is Python3, is not very convenient!
Installation of Ipython under Mac system supports Python2 and Python3 respectively