Python tips

Creating the code on Mac OS, to switch to Pi later

ensure pip install and upgraded
$ sudo pip install -U setuptools
$ sudo pip install pyserial
$ brew install mysql-connector-c ( on Mac OSX you need the mysql connection lib, will be installed if XCode installed apparently, see http://stackoverflow.com/questions/16182294/installing-mysql-python-on-mac-os-x)
$ sudo pip install MySQL-python

$ sudo pip install PyMySQL [alternative called pymysql which is a Python client connection to MySQL , follows same API as MySQL-python and works with Python 3 – this works so far…]

Can’t TCP into the server db so use SSH
sudo pip install paramiko [which also installs pycrypto and ecdsa]

>> import serial
>> import MySQLdb

For Pi:

  1. apt-get install python-mysqldb