Skip to content

Instantly share code, notes, and snippets.

@richardsalex
Created August 5, 2016 16:08
Show Gist options
  • Save richardsalex/b7e420a8dba0da0f44eeda90c2c827fe to your computer and use it in GitHub Desktop.
Save richardsalex/b7e420a8dba0da0f44eeda90c2c827fe to your computer and use it in GitHub Desktop.
Quick install guide for Python via Homebrew on OS X

Installing Python and Jupyter Notebooks on OS X

For the most part, everything will be done using OS X's Terminal.

We need to install the following (in this order) to get up and running:

  1. Homebrew (a package manager for OS X)
  2. Python (via Homebrew)
  3. Virtualenv (via Python's pip)
  4. Virtualenvwrapper (also via Python's pip)

We'll also need to create/alter your .bash_profile so that every time you open up a new Terminal window, you'll have access to these virtual environments and commands. The following will need to be added to whatever's already there or put inside a blank text file and saved as .bash_profile inside of your user folder (/Users/<username>/).

export WORKON_HOME=$HOME/Envs
source /usr/local/bin/virtualenvwrapper.sh

Next steps

From there, we'll create a new virtual environment and install a few third-party Python libraries like Jupyter, requests and BeautifulSoup which can help with scraping tasks.

The whole virtual environment thing is probably overkill for someone just starting out; I don't even really run into situations where it's critical. It's something developers use to keep different versions of third-party libraries and their dependencies (other libraries that help them work) from conflicting with each other.

It's like starting with a clean slate. If you mess something up, it's typically going to be limited to the virtual environment, too, so you can just delete it and create another.

So what's the deal with virtualenvwrapper? It basically gives you a set of commands which make it much easier to hop in and out of these virtual environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment