Skip to content

Instantly share code, notes, and snippets.

@jklymak
Created April 27, 2018 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jklymak/04685b28417a6f7ea791aa2ddb0ded25 to your computer and use it in GitHub Desktop.
Save jklymak/04685b28417a6f7ea791aa2ddb0ded25 to your computer and use it in GitHub Desktop.
Install python

Install Python and friends

  1. Go to https://www.anaconda.com/distribution/ and download conda (Choose python 3.6 - 2.7 is end-of-life)
  2. when it asks to modify your path, let it. That will make ~/anaconda3/bin/python your python instead of the system python which is at /usr/bin/python.

That should be everything!

Running

Command line:

% python myscript.py

Interactive:

% ipython

This will start an ipython shell where python commands can be entered (like the matlab shell)

Notebook

% jupyter notebook

This will open a jupyter notebook on your machine.
You may need to open in a browser using the address supplied. Note that I don't find Safari works that well, so often use Firefox.

There are two main types of cells "Code", where you enter and execute code (like the %% new cell in matlab editor) and "Markdown" cells where you can write comments. The lectures here were written in a notebook.

Note the %matplotlib notebook in the first code cell of this notebook. This tells matplotlib to render plots inside the notebook.

Learning

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