python install
python on windows
- download python 2.7.x windows installer from https://www.python.org/
- download psycopg2 windows installer from http://initd.org/psycopg/
python on mac
- python was already installed on mac, but it was Apple's version
- installed macports version of python
# to change to macports python... sudo port select --set python python27 # to change back... sudo port select --set python python27-apple
psycopg2 and mysql drivers were easily installed with macports using these commands:
sudo port install py27-psycopg2 sudo port install py27-mysql
however, for the following items, pip was used with apple python to learn how it works; each of these were available on macports and could easily be installed from there
pip and postgres driver
- install pip and psycopg2
- pip is a package manager for python
- download get-pip.py from https://pip.pypa.io/en/latest/installing.html
sudo python ~/Downloads/get-pip.py
sudo pip install psycopg2
failed because it couldn't find pg_config- postgres was already installed with macports, so I modified the path
export PATH=$PATH:/opt/local/lib/postgresql93/bin
- this now worked
sudo pip install psycopg2
sqlite
- sqlite3 is installed by default with python
mysql
- mysql was already installed with macports, so I modified the path
export PATH=$PATH:/opt/local/lib/mysql55/bin
- this now worked
sudo pip install MySQL-python
view installed modules
python
(starts an interactive python shell)help('modules')