9

If you install python3 through Homebrew it installs the latest version by default, which I did. But I want 3.3 instead of 3.4. How can I replace it with 3.3 specifically using Homebrew? I want to try Django with Python 3 but I'm just learning Django so I want to use the latest stable version, currently 1.6, which is compatible with up to Python 3.3. I want to use it with Python 3, so it has to be 3.3. Django 1.7 is Py3.4 compatible but I don't want to mess with that 'til it's stable... on OS X 10.8.5

user163831
  • 1,031
  • 3
  • 13
  • 25
  • 1
    The latest OS X comes with python 3.3.3 – Rafael Barros Jul 15 '14 at 20:49
  • 1
    possible duplicate of [Homebrew install specific version of formula?](http://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula) – Rafael Barros Jul 15 '14 at 20:51
  • Are you sure Django 1.6 *won't* work with Python 3.4, at least well enough to play around with it? – chepner Jul 15 '14 at 21:01
  • @chepner, no I'm not; just going by what it says officially on djangoproject.com. – user163831 Jul 15 '14 at 22:34
  • @RafaelBarros I should have mentioned I have OS X 10.8.5, which comes with Python 2.7... – user163831 Jul 15 '14 at 22:36
  • 2
    @RafaelBarros: 10.9.4 does not include python 3. Unless you're talking about the public beta? – Bill Lynch Jul 15 '14 at 22:41
  • @sharth 10.9.3 has python 3.3.3 when you type python3 on the terminal. OSX 10.9.4 updated it to 3.4.0 – Rafael Barros Jul 16 '14 at 15:54
  • @RafaelBarros: 10.9.4 does not include any version of Python 3. You have presumably installed an external version but if you look in /System/Library/Frameworks/Python.framework/Versions/ you'll see nothing later than 2.7 – Chris Adams Sep 01 '14 at 17:38
  • Consider using a virtualenv (or conda env) to install multiple versions of python at the same time and easily switch between them. I don't have a link handy, but Google should easily find something – Ben Jul 15 '18 at 15:44

1 Answers1

12

Here are some elements that you can piece together from the homebrew FAQ.

  1. Can I edit formulae myself? - yes.

    brew edit python3
    
  2. look for the url and change it to the ftp link to the 3.3 (3.3.6) archive.

  3. download the archive locally and compute the checksum with shasum.

  4. save the file as python33.rb and install with brew install --debug python33.rb.

Passing the --debug flag will help you in case some steps are not working properly (e.g. in the latest formula, removing the 2to3 binary was a problem), you may just try to revert this change as python3.3 does not have ensurepip bootstrap module.

You can find the formula I used here: python 3.3.5

dnozay
  • 23,846
  • 6
  • 82
  • 104
  • 1
    If you download the package manually and `shasum` it, you can copy + paste that output into the `sha256` variable when you're `brew edit python3`. This way you can `brew install python3` like normal – adambullmer Nov 04 '15 at 20:16
  • gist link is broken. – The Matt Jul 10 '18 at 14:07