Learning Python - mikec964/chelmbigstock GitHub Wiki
We're using Python.
- Here's a Python tutorial for experienced programmers Dive Into Python
- Here's another useful eBook from O'Reilly, available for free download - Python for Data Analysis
- Here's an interactive tutorial with videos: Edx MIT 6.00.1x Intro to Computer Science and Programming Using Python
- Here's a Python style guide
- Google Python Style Guide
- Packaging tutorial from Dive Into Python 3 and Python.org. Avazea has another, very helpful packaging tutorial.
-
Here's a list of classifiers
-
The README should be in reStructuredText for Pypi, and can be reStructuredText or MarkDown for GitHub. We're using MarkDown for this wiki.
- Here's an RST editor
-
Python progression path - From apprentice to guru
-
- Python in the Cloud - PythonAnywhere provides free python consoles with the IDLE interface as required by the books and tutorials above.
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:
- For Python 2.7 it is best to install Anaconda. You can install Python 3.3 in the Anaconda envs directory with [these instructions] (https://github.com/mikec964/chelmbigstock/wiki/Installing-environments-and-switching-between-Conda-Python-2.7,-3.3-and-3.4).
- For Python 3.3 it is best to install Miniconda. In the case that you didn't install Python 3.3 in the Anaconda envs.
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.
- Install pip with
sudo easy_install pip
- Install virtualenv with
sudo pip -U install virtualenv
- Install virtualenvwrapper with
sudo pip install -U virtualenvwrapper
- cd $HOME
- mkdir .virtualenvs
- Add
source /usr/local/bin/virtualenvwrapper.sh
to ~/.bash_rc. - You might want to create a virtualenv for Hadoop and one for Pygame, for example.
- Check out the instructions for virtualenvwrapper
- And some usage tips with autoenv
mkvirtualenv bigdata
lssitepackages
mkvirtualenv pygames
ls $WORKON_HOME
workon bigdata
- If needed, you can turn it off with
deactivate
. - If needed, you can remove a virtualenv with something like
rmvirtualenv pygames
.
Set up your bigdata env
- Install numpy for Python 2 with
pip install -U numpy
and on Python 3 withpip3 install -U numpy
. I think that requires that you have a C compiler (gcc) installed. - Install scipy for Python 2 with
pip install -U scipy
and on python 3 withpip install -U scipy
- Install sci-kit for Python 2 with
pip install -U scikit-learn
and on Python 3 withpip3 install -U scikit-learn
.