Installing Anaconda on MacOS
Download Anaconda
From Anaconda site
- Download Anaconda installer for MacOS from here: https://www.anaconda.com/download/
- Choose
Python 2.7
orPython 3.6
, read python2 vs python3
From Anaconda repository
- Download Anaconda installer for MacOS from here: https://repo.continuum.io/archive/ from the browser.
- There are two type
.sh
and.pkg
,.sh
requires you to use the Terminal.app while.pkg
install with double-click. - Here I will show you how to install via Terminal.app
Installing Anaconda via Terminal.app
- Open up a terminal.
-
cd
to your instaler folder, usually~/Downloads/
. - Type
sh ./AnacondaXXXXXXXX.sh
, whereAnacondaXXXXXXXX.sh
refers to the downloaded file name. - Follow the instructions on the screen. Accept the defaults if you are not sure what to do .
- Installation will be finished within 5 minutes.
- The following line will be appeared:
Do you wish the installer to prepend the AnacondaX install location to PATH in your /Users/XXX/.bash_profile ? [yes|no]
- If you use
bash
, you can typeyes
for easy installation. Read the next session aboutPATH variable
- Everything is done. Refresh your bash terminal by
source ~/.bash_profile
Anaconda PATH
variable
The Anaconda will NOT append the PATH
variable during Linux installation. To qurantee your installation is successful, you need to check your rcfile for Bash, i.e. the .bash_profile
stored under the Home directory of MacOS. To read the .bash_profile
:
- Type
cat ~/.bash_profile
in your terminal. - If you have the following lines at the end, it means the installation is ok.
# added by Anaconda2 installer export PATH="/Users/XXXXX/anacondaX/bin:$PATH"
- If you doesn’t got this line, first check the Anaconda installation location (usually /Users/XXXXX/anacondaX/) and add the following line (Replace /Users/XXXXX/anacondaX/ with your installation location) to
~/.bash_profile
using a text editor:export PATH="/Users/XXXXX/anacondaX/bin:$PATH"
- If you have no idea what is a text editor, open a terminal,
type
echo "export PATH="/Users/XXXXX/anacondaX/bin:$PATH"" >> ~/.bash_profile
and enter, of course you need to replace your installation folder here.
Successful Anaconda installation
- Run
source ~/.bash_profile
in the terminal. - Type
python
in the terminal. - Similar strings will be appeared:
Python 2.7.14 |Anaconda custom (64-bit)| (default, Oct 16 2017, 17:29:19) [GCC 7.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.
- If the following similar strings appeared, redo the previous session or run
source ~/.bash_profile
in the terminal.Python 2.7.14 (default, Jan 5 2018, 10:41:29) [GCC 7.2.1 20171224] on linux2 Type "help", "copyright", "credits" or "license" for more information.
Updating conda
- Open a terminal.
- Run
conda update anaconda
.
Uninstalling conda
- Open a terminal.
- Check the Anaconda installation path.
- Usually
~/anacondaX/
- Run
rm -fr ~/anacondaX/
- Open your
~/.bash_profile
- Find and remove the line
export PATH="/Users/XXXXX/anacondaX/bin:$PATH"
- Run
source ~/.bash_profile