Learning Python - mikec964/chelmbigstock GitHub Wiki

We're using Python.

Installing Python

We're trying to focus on Python 3, but in cases where libraries are not ready you'll need Python 2. You also need to install the "scipy" stack. For Mac and Windows, the easiest solution seems to be to install a version of Python that includes these:

Python by hand

Alternatively, you can go with the standard distribution and add the modules yourself. (Mike is doing this.) When installing packages, use pip instead of easy_install. You should usually use pip install -U; the -U option forces pip to upgrade the package to the latest version if it's already installed.

First, get Python 2 and Python 3 from Python.org

http://docs.python-guide.org/en/latest/starting/install/osx/

Warning: I'm not clear on virtualenv and Python3.

Install Pip, Virtualenv, and Virtualenvwrapper:

VirtualEnv creates a sandbox for each project where you can have a unique set of libraries. Here's a Primer on virtualenv. In Python 3.3, it's being replaced by venv.

  1. Install pip with sudo easy_install pip
  2. Install virtualenv with sudo pip -U install virtualenv
  3. Install virtualenvwrapper with sudo pip install -U virtualenvwrapper
  4. cd $HOME
  5. mkdir .virtualenvs
  6. Add source /usr/local/bin/virtualenvwrapper.sh to ~/.bash_rc.
  7. You might want to create a virtualenv for Hadoop and one for Pygame, for example.
  8. Check out the instructions for virtualenvwrapper
  9. And some usage tips with autoenv
  10. mkvirtualenv bigdata
  11. lssitepackages
  12. mkvirtualenv pygames
  13. ls $WORKON_HOME
  14. workon bigdata
  15. If needed, you can turn it off with deactivate.
  16. If needed, you can remove a virtualenv with something like rmvirtualenv pygames.

Set up your bigdata env

  1. Install numpy for Python 2 with pip install -U numpy and on Python 3 with pip3 install -U numpy. I think that requires that you have a C compiler (gcc) installed.
  2. Install scipy for Python 2 with pip install -U scipy and on python 3 with pip install -U scipy
  3. Install sci-kit for Python 2 with pip install -U scikit-learn and on Python 3 with pip3 install -U scikit-learn.