#!/usr/bin/env python # coding: utf-8 # # How to install python for data analysis - for Mac # Adam Claridge-Chang June 2015 # ### How to install Anaconda for Mac # Google "anaconda python" and click through to the relevant download page. # # Use installer to install. When complete, there will be a shortcut on your desktop that looks like below # In[1]: from IPython.display import Image Image(filename='/Users/adamcc77/Desktop/anaconda_symbol.jpg') # Click on that icon, the Launcher will appear. Click on the IPython Notebook. # ### Install a package that is not in the Anaconda distribution # # On the package's homepage, see if they offer pip installation - most will. # # Most packages are hosted on the PYthon Package Index (PYPI), so are installable with pip. # For example to install RPy2, a package for running R code in IPython, you can type this in Terminal # # $ pip install rpy2 # # ### How to add a folder to your path # You may want to organize your custom scripts into a folder that is not mixed in with the Anaconda modules # ####1) Find your bash profile # In Terminal on the command line type (without the $ sign, which is the prompt) # # $ cd # $ ls -a # # This means "change directory to my home folder, list all files including hidden files". # # You should see a file called .bash_profile listed there # # # ####2) Edit your bash profile. # Into the command line type # # $ open .bash_profile # # This should open in TextEdit. Add two lines to the text file: # # \# Added by My Name on My Date # export PYTHONPATH="/Users/myusername/path/to/folder:$PYTHONPATH" # ####3) Check that this worked. # Open a python session: # # \>>> import sys # \>>> sys.path # # The new folder should now be listed in your path # ### How to see which packages have been installed # # As per this page https://stackoverflow.com/questions/739993/how-can-i-get-a-list-of-locally-installed-python-modules # In[2]: import pip installed_packages = pip.get_installed_distributions() installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages]) print(installed_packages_list) # ###How to share a notebook on nbviewer # # 1) Get a Github account # # 2) Make your notebook # # 3) Watch this video https://www.youtube.com/watch?v=eYVCH61fKyY # # 4) Share the link to the notebook # In[ ]: