Setting up programming environment is frustrating for newcomers. Although it is much easier than it was before, it’s still worth it to take note.
1. Apple developer tools
Not only the python development but all kinds of programming tasks on OSX require Apple developer tools. The instruction is easy; you download XCode from Mac AppStore, then you download Command Line Tools in the Downloads menu from the XCode Preference panel.
2. Homebrew
Next, install OSX most popular package manager homebrew. Just copy and paste this command in the terminal.
1
|
|
If it shows an error about user permission, do the following
1 2 |
|
and setup environment variables in ~/.bash_profile
(if the file does not exist, create one)
1
|
|
Now you can install the followings with homebrew.
1 2 3 4 5 |
|
Years before Mountain Lion, I used to install fortran via High Performance Computing for Mac OSX, but it doesn’t work well with homebrew. Now it’s best to install everything with homebrew.
3. Python Virtualenv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Now, if you type which pip
it should print /Users/YOUR_HOME/.virtualenvs/data-scientists/bin/pip
.
Install scipy, numpy, ipython, and matplot.
1 2 3 4 5 6 7 8 |
|
Finally, install opencv
1 2 |
|
If you want a additional nice GUI application for ipython, you can download it from IPython Notebook.
Trouble shooting
Sometimes homebrew has trouble with fetching the source code. If you found it is stuck on downloading the files, do the following
1
|
|
It will show the URL of the file it is going to download. Stop the command with ctrl-c, paste the URL to your browser and download it. After the download is complete, move the file to /Library/Cache/Homebrew
.
1
|
|
Continue the installation by
1 2 |
|