Professional Documents
Culture Documents
Installation Steps MAC
Installation Steps MAC
Installation Steps MAC
on Mac
Python is a cross-platform language. This means that if you have written code on one operating system
(say Windows), given that the code has been written properly, it would work without any issues on
systems with other operating systems (say Mac OS X or Linux), provided Python is correctly installed.
Although Python can be used seamlessly across different systems, the procedure to install Python
differs slightly on different operating systems. The focus of this document is installation of Python
and Anaconda on systems with Mac OS X.
Most OS X and Linux operating systems already come with Python installed. Even if its installed on
your system, you need to see if the recent version of Python is installed on your system. Follow the steps
below to check the version of Python.
1. Open the “terminal window” by going to Applications>Utilities> Terminal. Alternatively, you can
use the shortcut key -spacebar, and type “terminal” and press the Enter key.
2. To see the version of Python installed, enter python with a “lower-case p”. You should see which
Python version is installed on your system, and >>> prompt, where you can start entering Python
commands. For instance, the screenshot indicates that Python 2.7.15 is the default version on this
system.
3. Once you have seen the output above, you can press Control -D or enter exit() to leave the
Python prompt and return to a terminal prompt.
1. To check whether you have Python 3 installed, within the terminal window enter the command
“python3”. If it’s not installed, you’ll probably get an error message.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Close the terminal window and proceed for next steps.
One of the issues with Mac OS X users is that the installed version of Python may have a set of
permissions that may not allow users to install external packages. Hence its recommended that
Anaconda distribution of Python is installed alongside the system version.
3. Clicking on Continue
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
4. Click on continue
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
5. Click on continue
6. Click on Continue
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
7. Agree to the terms and click continue
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
8. Click on Install
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
9. You should get a screen stating that installation has been completed
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Test if Installation is successful
Open a new terminal on your Mac. You can do this by clicking on the Spotlight magnifying glass at the
top right of the screen, type “terminal” then click on the terminal icon. Now, type the “python –version”
command into your terminal. If the installation is successful you should see the window as below
Another good way to test your installation is to try and open a Jupyter Notebook. You can type the
“Jupyter notebook” command below in your terminal to open a Jupyter Notebook. If the command fails,
chances are that Anaconda isn’t in your path. We will see how this can be resolved in a moment.
When people have installed multiple different versions of Anaconda, and have multiple versions of
Anaconda in their path, they usually face problems in launching Jupyter notebook. To fix that follow the
steps as below:
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
1. Open a new terminal and go to your home directory. You can do this by using the cd~command as
seen below.
2. Use the cat command to see the contents of the hidden file .bash_profile. Type the following
command into your terminal.
3. If you see more than one Anaconda version (as seen below), proceed to the next step.
4. To remove the old version of Anaconda from your .bash_profile use the command below to edit the
file using the nano editor.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
5. From the image above, notice there is a newer Version of Anaconda. Simply remove the older
version of Anaconda. Type control + X to exit out of nano
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
6. Save changes by typing Y.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Close the terminal window and you should be good now. Note that this is not the only issue, but one of
the most common issues seen while installing anaconda on Mac.
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited