docs:python:install

python install

  • 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

  • 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
  • sqlite3 is installed by default with python
  • 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
  • python (starts an interactive python shell)
  • help('modules')
  • docs/python/install.txt
  • Last modified: 2014/06/30 22:40
  • by billh