Complete Python for Scientific Computing Cheatsheet

Here’s everything you need to do, in the order you need to do it, using MacPorts as your basis. Please note this assumes that everything you need to do is in the most recent version of Python, which as of this date is Python 3.4.

First, install Xcode. (Workaround in the offing.)

Second, install Xcode command-line tools. First, this:

xcode-select –install

And, then, you’ll need to do this:

sudo xcodebuild -license

Third, download and install the MacPorts base package.

Fourth, once the base package is installed, run:

sudo port selfupdate

Now, we need to install Python and the various libraries. The basic setup is:

sudo port install python34
sudo port install py34-numpy
sudo port install py34-scipy
sudo port install py34-matplotlib
sudo port install py34-pandas
sudo port select –set python python34

If you would like the option of using *Jupyter* notebooks:

sudo port install py34-ipython
sudo port select –set ipython py34-ipython
sudo port install py34-jupyter

If you’re interested in doing text analytics, then you’ll probably find the following libraries useful. (Please note that the first line below is a workaround to keep NLTK from installing Python 2.)

sudo port install xorg-xcb-proto +python34
sudo port install py34-nltk

If you would like to add R to your arsenal of weapons and to have it work within Jupyter notebook:

sudo port install R
sudo port install py34-zmq

Then, in R, using sudo:

install.packages(c(‘rzmq’,’repr’,’IRkernel’,’IRdisplay’),
repos = c(‘http://irkernel.github.io/’,
getOption(‘repos’)))

IRkernel::installspec()

Leave a Reply