How to set up Python 3 on OS X

I never remember, so I need to write this down

  1. Get Python 3 (from Python.org)
    • Hmm … Python 3.4.0 was released a few weeks ago. I may¬†wait another week to see if 3.4.1 is released.
  2. install ‘distribute’, not ‘setuptools’
    • setup_tools is for Python 2, distribute is for Python 3
    • Use this command:
      “> curl -O http://python-distribute.org/distribute_setup.py
    • Go to the folder where it’s located and run
      “>python3 distribute_setup.py”
    • “easy_install” should be included
  3. Create a soft link to easy_install
    • For OS X, it should be in /Library/Frameworks/Python.Frameworks/Versions/3.3/bin, once it’s installed
    • I created an alias in my .profile, but it does not work with ‘sudo’
  4. Run ‘>sudo easy_install pip’ to install pip
    • It should be in /Library/Frameworks/Python.Frameworks/Version/3.3/bin
  5. set up another soft link to pip
    • “> ln -s /Library/Frameworks/Python.Frameworks/Versions/3.3/bin/pip pip”

Neat modules to consider

  • Beautiful Soup 4 (screen scraping)
  • virtualenv (isolated copies of Python)
  • httplib2 (replacement and enhancement for urllib.request.urlopen
  • mysql connector (connects Python to MySQL)
Advertisements