How can I install a previous version of Python 3 in macOS using homebrew?

Multi tool use
Multi tool use












76















How can I install a previous version of Python 3 in macOS using brew?



With the command brew install python I got the latest version of Python 3 (currently v3.7.0), but I want the last version of Python 3.6 (currently 3.6.5).



I have read about another package pyenv that can assist in handle different python installation, but this solution is not suitable for me.










share|improve this question























  • For what it's worth, Homebrew's support for multiple versions of Python is abysmal, and is progressively getting worse. I would recommend you avoid using Homebrew to install Python at all. Python.org provides macOS install packages for various versions of Python which can be installed side-by-side with each other (and side-by-side with a Homebrew Python installation if you want). Either using those packages or using a tool like pyenv will ultimately save you a lot of grief in the long run.

    – Daniel Pryden
    Jan 30 at 15:30


















76















How can I install a previous version of Python 3 in macOS using brew?



With the command brew install python I got the latest version of Python 3 (currently v3.7.0), but I want the last version of Python 3.6 (currently 3.6.5).



I have read about another package pyenv that can assist in handle different python installation, but this solution is not suitable for me.










share|improve this question























  • For what it's worth, Homebrew's support for multiple versions of Python is abysmal, and is progressively getting worse. I would recommend you avoid using Homebrew to install Python at all. Python.org provides macOS install packages for various versions of Python which can be installed side-by-side with each other (and side-by-side with a Homebrew Python installation if you want). Either using those packages or using a tool like pyenv will ultimately save you a lot of grief in the long run.

    – Daniel Pryden
    Jan 30 at 15:30
















76












76








76


27






How can I install a previous version of Python 3 in macOS using brew?



With the command brew install python I got the latest version of Python 3 (currently v3.7.0), but I want the last version of Python 3.6 (currently 3.6.5).



I have read about another package pyenv that can assist in handle different python installation, but this solution is not suitable for me.










share|improve this question














How can I install a previous version of Python 3 in macOS using brew?



With the command brew install python I got the latest version of Python 3 (currently v3.7.0), but I want the last version of Python 3.6 (currently 3.6.5).



I have read about another package pyenv that can assist in handle different python installation, but this solution is not suitable for me.







python macos homebrew






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 1 '18 at 16:20









ePi272314ePi272314

4,12822021




4,12822021













  • For what it's worth, Homebrew's support for multiple versions of Python is abysmal, and is progressively getting worse. I would recommend you avoid using Homebrew to install Python at all. Python.org provides macOS install packages for various versions of Python which can be installed side-by-side with each other (and side-by-side with a Homebrew Python installation if you want). Either using those packages or using a tool like pyenv will ultimately save you a lot of grief in the long run.

    – Daniel Pryden
    Jan 30 at 15:30





















  • For what it's worth, Homebrew's support for multiple versions of Python is abysmal, and is progressively getting worse. I would recommend you avoid using Homebrew to install Python at all. Python.org provides macOS install packages for various versions of Python which can be installed side-by-side with each other (and side-by-side with a Homebrew Python installation if you want). Either using those packages or using a tool like pyenv will ultimately save you a lot of grief in the long run.

    – Daniel Pryden
    Jan 30 at 15:30



















For what it's worth, Homebrew's support for multiple versions of Python is abysmal, and is progressively getting worse. I would recommend you avoid using Homebrew to install Python at all. Python.org provides macOS install packages for various versions of Python which can be installed side-by-side with each other (and side-by-side with a Homebrew Python installation if you want). Either using those packages or using a tool like pyenv will ultimately save you a lot of grief in the long run.

– Daniel Pryden
Jan 30 at 15:30







For what it's worth, Homebrew's support for multiple versions of Python is abysmal, and is progressively getting worse. I would recommend you avoid using Homebrew to install Python at all. Python.org provides macOS install packages for various versions of Python which can be installed side-by-side with each other (and side-by-side with a Homebrew Python installation if you want). Either using those packages or using a tool like pyenv will ultimately save you a lot of grief in the long run.

– Daniel Pryden
Jan 30 at 15:30














4 Answers
4






active

oldest

votes


















148














Short Answer



To make a clean install of Python 3.6.5 use:



brew unlink python # ONLY if you have installed (with brew) another version of python 3
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


If you receive this error Error: python contains a recursive dependency on itself,

please see the answer of @François below.



If you prefer to recover a previously installed version, then:



brew info python           # To see what you have previously installed
brew switch python 3.x.x_x # Ex. 3.6.5_1


Long Answer



There are two formulas for installing Python with Homebrew: python@2 and python.

The first is for Python 2 and the second for Python 3.



Note: You can find outdated answers on the web where it is mentioned python3 as the formula name for installing Python version 3. Now it's just python!



By default, with these formulas you can install the latest version of the corresponding major version of Python. So, you cannot directly install a minor version like 3.6.



Solution



With brew, you can install a package using the address of the formula, for example in a git repository.



brew install https://the/address/to/the/formula/FORMULA_NAME.rb


Or specifically for Python 3



brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/COMMIT_IDENTIFIER/Formula/python.rb


The address you must specify is the address to the last commit of the formula (python.rb) for the desired version.
You can find the commint identifier by looking at the history for homebrew-core/Formula/python.rb



https://github.com/Homebrew/homebrew-core/commits/master/Formula/python.rb



Python > 3.6.5



In the link above you will not find a formula for a version of Python above 3.6.5.
After the maintainers of that (official) repository released Python 3.7, they only submit updates to the recipe of Python 3.7.



As explained above, with homebrew you have only Python 2 (python@2) and Python 3 (python), there is no explicit formula for Python 3.6.



Although those minor updates are mostly irrelevant in most cases and for most users, I will search if someone has done an explicit formula for 3.6.






share|improve this answer





















  • 2





    How will this affect or interact with packages in Homebrew that rely on the default python3 interpreter?

    – Telemachus
    Jul 22 '18 at 22:31








  • 1





    In any case, a Python depending applications (installed with brew or not) will look for a python3 executable in the applications path, and you will have python3 pointing to python3.6. Thus, your default Python 3 will be 3.6 (if you use the example above) and that should be enough. Python 3.7 is so recent; I doubt there is an application that requires explicitly Python 3.7, in the same way, I don't know any application that only works with Python 3.6. In other words. You will be fine :)

    – ePi272314
    Jul 24 '18 at 0:46








  • 2





    I have 3.7 installed and received this error: Error: python 3.7.0 is already installed To install 3.6.5_1, first run brew unlink python`` when using the 'short answer'.

    – wuliwong
    Oct 18 '18 at 20:51






  • 1





    Thank you for providing the direct commit link for 3.6.5. You saved me from a hopeless situation.

    – tsalaroth
    Nov 4 '18 at 14:18






  • 1





    I know this is a bit older, but I am struggling trying to figure out how you got the link to the formula. The current version of 3.6 is 3.6.7, is there some simple approach to finding this formula?

    – diek
    Nov 22 '18 at 1:14



















11














As an update, when doing



brew unlink python # If you have installed (with brew) another version of python
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


You may encounter



Error: python contains a recursive dependency on itself:
python depends on sphinx-doc
sphinx-doc depends on python


To bypass it, add the --ignore-dependencies argument to brew install.



brew unlink python # If you have installed (with brew) another version of python
brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb





share|improve this answer
























  • and then you'll have a nightmare with dependency hell... like discourse.brew.sh/t/brew-install-python3-fails/1756/7

    – confiq
    Jan 23 at 11:51











  • this didn't work for me at first; essentially had to do this: brew install --debug --ignore-dependencies raw.githubusercontent.com/Homebrew/homebrew-core/… and once it fails in make html, just ignore the error by selecting 2). the html/docs failure will probably bite me later on, but for now it's working fine :shrug:

    – beans
    Jan 29 at 6:25



















0














To solve this with homebrew, you can temporarily backdate homebrew-core and set the HOMEBREW_NO_AUTO_UPDATE variable to hold it in place:



cd `brew --repo homebrew/core`
git checkout f2a764ef944b1080be64bd88dca9a1d80130c558
export HOMEBREW_NO_AUTO_UPDATE=1
brew install python


I don't recommend permanently backdating homebrew-core, as you will miss out on security patches, but it is useful for testing purposes.



You can also extract old versions of homebrew formulae into your own tap (tap_owner/tap_name) using the brew extract command:



brew extract python tap_owner/tap_name --version=3.6.5





share|improve this answer































    0














    What I did was first I installed python 3.7 brew install python3 then brew unlink python then I installed python 3.6.5 using above link brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb --ignore-dependencies


    After that I ran brew link --overwrite python. Now I have all pythons in the system to create the virtual environments.



    mian@tdowrick2~ $ python --version
    Python 2.7.10
    mian@tdowrick2~ $ python3.7 --version
    Python 3.7.1
    mian@tdowrick2~ $ python3.6 --version
    Python 3.6.5


    To create Python 3.7 virtual environment.



    mian@tdowrick2~ $ virtualenv -p python3.7 env
    Already using interpreter /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
    Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
    New python executable in /Users/mian/env/bin/python3.7
    Also creating executable in /Users/mian/env/bin/python
    Installing setuptools, pip, wheel...
    done.
    mian@tdowrick2~ $ source env/bin/activate
    (env) mian@tdowrick2~ $ python --version
    Python 3.7.1
    (env) mian@tdowrick2~ $ deactivate


    To create Python 3.6 virtual environment



    mian@tdowrick2~ $ virtualenv -p python3.6 env
    Running virtualenv with interpreter /usr/local/bin/python3.6
    Using base prefix '/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6'
    New python executable in /Users/mian/env/bin/python3.6
    Not overwriting existing python script /Users/mian/env/bin/python (you must use /Users/mian/env/bin/python3.6)
    Installing setuptools, pip, wheel...
    done.
    mian@tdowrick2~ $ source env/bin/activate
    (env) mian@tdowrick2~ $ python --version
    Python 3.6.5
    (env) mian@tdowrick2~ $





    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51125013%2fhow-can-i-install-a-previous-version-of-python-3-in-macos-using-homebrew%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      148














      Short Answer



      To make a clean install of Python 3.6.5 use:



      brew unlink python # ONLY if you have installed (with brew) another version of python 3
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


      If you receive this error Error: python contains a recursive dependency on itself,

      please see the answer of @François below.



      If you prefer to recover a previously installed version, then:



      brew info python           # To see what you have previously installed
      brew switch python 3.x.x_x # Ex. 3.6.5_1


      Long Answer



      There are two formulas for installing Python with Homebrew: python@2 and python.

      The first is for Python 2 and the second for Python 3.



      Note: You can find outdated answers on the web where it is mentioned python3 as the formula name for installing Python version 3. Now it's just python!



      By default, with these formulas you can install the latest version of the corresponding major version of Python. So, you cannot directly install a minor version like 3.6.



      Solution



      With brew, you can install a package using the address of the formula, for example in a git repository.



      brew install https://the/address/to/the/formula/FORMULA_NAME.rb


      Or specifically for Python 3



      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/COMMIT_IDENTIFIER/Formula/python.rb


      The address you must specify is the address to the last commit of the formula (python.rb) for the desired version.
      You can find the commint identifier by looking at the history for homebrew-core/Formula/python.rb



      https://github.com/Homebrew/homebrew-core/commits/master/Formula/python.rb



      Python > 3.6.5



      In the link above you will not find a formula for a version of Python above 3.6.5.
      After the maintainers of that (official) repository released Python 3.7, they only submit updates to the recipe of Python 3.7.



      As explained above, with homebrew you have only Python 2 (python@2) and Python 3 (python), there is no explicit formula for Python 3.6.



      Although those minor updates are mostly irrelevant in most cases and for most users, I will search if someone has done an explicit formula for 3.6.






      share|improve this answer





















      • 2





        How will this affect or interact with packages in Homebrew that rely on the default python3 interpreter?

        – Telemachus
        Jul 22 '18 at 22:31








      • 1





        In any case, a Python depending applications (installed with brew or not) will look for a python3 executable in the applications path, and you will have python3 pointing to python3.6. Thus, your default Python 3 will be 3.6 (if you use the example above) and that should be enough. Python 3.7 is so recent; I doubt there is an application that requires explicitly Python 3.7, in the same way, I don't know any application that only works with Python 3.6. In other words. You will be fine :)

        – ePi272314
        Jul 24 '18 at 0:46








      • 2





        I have 3.7 installed and received this error: Error: python 3.7.0 is already installed To install 3.6.5_1, first run brew unlink python`` when using the 'short answer'.

        – wuliwong
        Oct 18 '18 at 20:51






      • 1





        Thank you for providing the direct commit link for 3.6.5. You saved me from a hopeless situation.

        – tsalaroth
        Nov 4 '18 at 14:18






      • 1





        I know this is a bit older, but I am struggling trying to figure out how you got the link to the formula. The current version of 3.6 is 3.6.7, is there some simple approach to finding this formula?

        – diek
        Nov 22 '18 at 1:14
















      148














      Short Answer



      To make a clean install of Python 3.6.5 use:



      brew unlink python # ONLY if you have installed (with brew) another version of python 3
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


      If you receive this error Error: python contains a recursive dependency on itself,

      please see the answer of @François below.



      If you prefer to recover a previously installed version, then:



      brew info python           # To see what you have previously installed
      brew switch python 3.x.x_x # Ex. 3.6.5_1


      Long Answer



      There are two formulas for installing Python with Homebrew: python@2 and python.

      The first is for Python 2 and the second for Python 3.



      Note: You can find outdated answers on the web where it is mentioned python3 as the formula name for installing Python version 3. Now it's just python!



      By default, with these formulas you can install the latest version of the corresponding major version of Python. So, you cannot directly install a minor version like 3.6.



      Solution



      With brew, you can install a package using the address of the formula, for example in a git repository.



      brew install https://the/address/to/the/formula/FORMULA_NAME.rb


      Or specifically for Python 3



      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/COMMIT_IDENTIFIER/Formula/python.rb


      The address you must specify is the address to the last commit of the formula (python.rb) for the desired version.
      You can find the commint identifier by looking at the history for homebrew-core/Formula/python.rb



      https://github.com/Homebrew/homebrew-core/commits/master/Formula/python.rb



      Python > 3.6.5



      In the link above you will not find a formula for a version of Python above 3.6.5.
      After the maintainers of that (official) repository released Python 3.7, they only submit updates to the recipe of Python 3.7.



      As explained above, with homebrew you have only Python 2 (python@2) and Python 3 (python), there is no explicit formula for Python 3.6.



      Although those minor updates are mostly irrelevant in most cases and for most users, I will search if someone has done an explicit formula for 3.6.






      share|improve this answer





















      • 2





        How will this affect or interact with packages in Homebrew that rely on the default python3 interpreter?

        – Telemachus
        Jul 22 '18 at 22:31








      • 1





        In any case, a Python depending applications (installed with brew or not) will look for a python3 executable in the applications path, and you will have python3 pointing to python3.6. Thus, your default Python 3 will be 3.6 (if you use the example above) and that should be enough. Python 3.7 is so recent; I doubt there is an application that requires explicitly Python 3.7, in the same way, I don't know any application that only works with Python 3.6. In other words. You will be fine :)

        – ePi272314
        Jul 24 '18 at 0:46








      • 2





        I have 3.7 installed and received this error: Error: python 3.7.0 is already installed To install 3.6.5_1, first run brew unlink python`` when using the 'short answer'.

        – wuliwong
        Oct 18 '18 at 20:51






      • 1





        Thank you for providing the direct commit link for 3.6.5. You saved me from a hopeless situation.

        – tsalaroth
        Nov 4 '18 at 14:18






      • 1





        I know this is a bit older, but I am struggling trying to figure out how you got the link to the formula. The current version of 3.6 is 3.6.7, is there some simple approach to finding this formula?

        – diek
        Nov 22 '18 at 1:14














      148












      148








      148







      Short Answer



      To make a clean install of Python 3.6.5 use:



      brew unlink python # ONLY if you have installed (with brew) another version of python 3
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


      If you receive this error Error: python contains a recursive dependency on itself,

      please see the answer of @François below.



      If you prefer to recover a previously installed version, then:



      brew info python           # To see what you have previously installed
      brew switch python 3.x.x_x # Ex. 3.6.5_1


      Long Answer



      There are two formulas for installing Python with Homebrew: python@2 and python.

      The first is for Python 2 and the second for Python 3.



      Note: You can find outdated answers on the web where it is mentioned python3 as the formula name for installing Python version 3. Now it's just python!



      By default, with these formulas you can install the latest version of the corresponding major version of Python. So, you cannot directly install a minor version like 3.6.



      Solution



      With brew, you can install a package using the address of the formula, for example in a git repository.



      brew install https://the/address/to/the/formula/FORMULA_NAME.rb


      Or specifically for Python 3



      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/COMMIT_IDENTIFIER/Formula/python.rb


      The address you must specify is the address to the last commit of the formula (python.rb) for the desired version.
      You can find the commint identifier by looking at the history for homebrew-core/Formula/python.rb



      https://github.com/Homebrew/homebrew-core/commits/master/Formula/python.rb



      Python > 3.6.5



      In the link above you will not find a formula for a version of Python above 3.6.5.
      After the maintainers of that (official) repository released Python 3.7, they only submit updates to the recipe of Python 3.7.



      As explained above, with homebrew you have only Python 2 (python@2) and Python 3 (python), there is no explicit formula for Python 3.6.



      Although those minor updates are mostly irrelevant in most cases and for most users, I will search if someone has done an explicit formula for 3.6.






      share|improve this answer















      Short Answer



      To make a clean install of Python 3.6.5 use:



      brew unlink python # ONLY if you have installed (with brew) another version of python 3
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


      If you receive this error Error: python contains a recursive dependency on itself,

      please see the answer of @François below.



      If you prefer to recover a previously installed version, then:



      brew info python           # To see what you have previously installed
      brew switch python 3.x.x_x # Ex. 3.6.5_1


      Long Answer



      There are two formulas for installing Python with Homebrew: python@2 and python.

      The first is for Python 2 and the second for Python 3.



      Note: You can find outdated answers on the web where it is mentioned python3 as the formula name for installing Python version 3. Now it's just python!



      By default, with these formulas you can install the latest version of the corresponding major version of Python. So, you cannot directly install a minor version like 3.6.



      Solution



      With brew, you can install a package using the address of the formula, for example in a git repository.



      brew install https://the/address/to/the/formula/FORMULA_NAME.rb


      Or specifically for Python 3



      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/COMMIT_IDENTIFIER/Formula/python.rb


      The address you must specify is the address to the last commit of the formula (python.rb) for the desired version.
      You can find the commint identifier by looking at the history for homebrew-core/Formula/python.rb



      https://github.com/Homebrew/homebrew-core/commits/master/Formula/python.rb



      Python > 3.6.5



      In the link above you will not find a formula for a version of Python above 3.6.5.
      After the maintainers of that (official) repository released Python 3.7, they only submit updates to the recipe of Python 3.7.



      As explained above, with homebrew you have only Python 2 (python@2) and Python 3 (python), there is no explicit formula for Python 3.6.



      Although those minor updates are mostly irrelevant in most cases and for most users, I will search if someone has done an explicit formula for 3.6.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 25 at 0:00

























      answered Jul 1 '18 at 16:20









      ePi272314ePi272314

      4,12822021




      4,12822021








      • 2





        How will this affect or interact with packages in Homebrew that rely on the default python3 interpreter?

        – Telemachus
        Jul 22 '18 at 22:31








      • 1





        In any case, a Python depending applications (installed with brew or not) will look for a python3 executable in the applications path, and you will have python3 pointing to python3.6. Thus, your default Python 3 will be 3.6 (if you use the example above) and that should be enough. Python 3.7 is so recent; I doubt there is an application that requires explicitly Python 3.7, in the same way, I don't know any application that only works with Python 3.6. In other words. You will be fine :)

        – ePi272314
        Jul 24 '18 at 0:46








      • 2





        I have 3.7 installed and received this error: Error: python 3.7.0 is already installed To install 3.6.5_1, first run brew unlink python`` when using the 'short answer'.

        – wuliwong
        Oct 18 '18 at 20:51






      • 1





        Thank you for providing the direct commit link for 3.6.5. You saved me from a hopeless situation.

        – tsalaroth
        Nov 4 '18 at 14:18






      • 1





        I know this is a bit older, but I am struggling trying to figure out how you got the link to the formula. The current version of 3.6 is 3.6.7, is there some simple approach to finding this formula?

        – diek
        Nov 22 '18 at 1:14














      • 2





        How will this affect or interact with packages in Homebrew that rely on the default python3 interpreter?

        – Telemachus
        Jul 22 '18 at 22:31








      • 1





        In any case, a Python depending applications (installed with brew or not) will look for a python3 executable in the applications path, and you will have python3 pointing to python3.6. Thus, your default Python 3 will be 3.6 (if you use the example above) and that should be enough. Python 3.7 is so recent; I doubt there is an application that requires explicitly Python 3.7, in the same way, I don't know any application that only works with Python 3.6. In other words. You will be fine :)

        – ePi272314
        Jul 24 '18 at 0:46








      • 2





        I have 3.7 installed and received this error: Error: python 3.7.0 is already installed To install 3.6.5_1, first run brew unlink python`` when using the 'short answer'.

        – wuliwong
        Oct 18 '18 at 20:51






      • 1





        Thank you for providing the direct commit link for 3.6.5. You saved me from a hopeless situation.

        – tsalaroth
        Nov 4 '18 at 14:18






      • 1





        I know this is a bit older, but I am struggling trying to figure out how you got the link to the formula. The current version of 3.6 is 3.6.7, is there some simple approach to finding this formula?

        – diek
        Nov 22 '18 at 1:14








      2




      2





      How will this affect or interact with packages in Homebrew that rely on the default python3 interpreter?

      – Telemachus
      Jul 22 '18 at 22:31







      How will this affect or interact with packages in Homebrew that rely on the default python3 interpreter?

      – Telemachus
      Jul 22 '18 at 22:31






      1




      1





      In any case, a Python depending applications (installed with brew or not) will look for a python3 executable in the applications path, and you will have python3 pointing to python3.6. Thus, your default Python 3 will be 3.6 (if you use the example above) and that should be enough. Python 3.7 is so recent; I doubt there is an application that requires explicitly Python 3.7, in the same way, I don't know any application that only works with Python 3.6. In other words. You will be fine :)

      – ePi272314
      Jul 24 '18 at 0:46







      In any case, a Python depending applications (installed with brew or not) will look for a python3 executable in the applications path, and you will have python3 pointing to python3.6. Thus, your default Python 3 will be 3.6 (if you use the example above) and that should be enough. Python 3.7 is so recent; I doubt there is an application that requires explicitly Python 3.7, in the same way, I don't know any application that only works with Python 3.6. In other words. You will be fine :)

      – ePi272314
      Jul 24 '18 at 0:46






      2




      2





      I have 3.7 installed and received this error: Error: python 3.7.0 is already installed To install 3.6.5_1, first run brew unlink python`` when using the 'short answer'.

      – wuliwong
      Oct 18 '18 at 20:51





      I have 3.7 installed and received this error: Error: python 3.7.0 is already installed To install 3.6.5_1, first run brew unlink python`` when using the 'short answer'.

      – wuliwong
      Oct 18 '18 at 20:51




      1




      1





      Thank you for providing the direct commit link for 3.6.5. You saved me from a hopeless situation.

      – tsalaroth
      Nov 4 '18 at 14:18





      Thank you for providing the direct commit link for 3.6.5. You saved me from a hopeless situation.

      – tsalaroth
      Nov 4 '18 at 14:18




      1




      1





      I know this is a bit older, but I am struggling trying to figure out how you got the link to the formula. The current version of 3.6 is 3.6.7, is there some simple approach to finding this formula?

      – diek
      Nov 22 '18 at 1:14





      I know this is a bit older, but I am struggling trying to figure out how you got the link to the formula. The current version of 3.6 is 3.6.7, is there some simple approach to finding this formula?

      – diek
      Nov 22 '18 at 1:14













      11














      As an update, when doing



      brew unlink python # If you have installed (with brew) another version of python
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


      You may encounter



      Error: python contains a recursive dependency on itself:
      python depends on sphinx-doc
      sphinx-doc depends on python


      To bypass it, add the --ignore-dependencies argument to brew install.



      brew unlink python # If you have installed (with brew) another version of python
      brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb





      share|improve this answer
























      • and then you'll have a nightmare with dependency hell... like discourse.brew.sh/t/brew-install-python3-fails/1756/7

        – confiq
        Jan 23 at 11:51











      • this didn't work for me at first; essentially had to do this: brew install --debug --ignore-dependencies raw.githubusercontent.com/Homebrew/homebrew-core/… and once it fails in make html, just ignore the error by selecting 2). the html/docs failure will probably bite me later on, but for now it's working fine :shrug:

        – beans
        Jan 29 at 6:25
















      11














      As an update, when doing



      brew unlink python # If you have installed (with brew) another version of python
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


      You may encounter



      Error: python contains a recursive dependency on itself:
      python depends on sphinx-doc
      sphinx-doc depends on python


      To bypass it, add the --ignore-dependencies argument to brew install.



      brew unlink python # If you have installed (with brew) another version of python
      brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb





      share|improve this answer
























      • and then you'll have a nightmare with dependency hell... like discourse.brew.sh/t/brew-install-python3-fails/1756/7

        – confiq
        Jan 23 at 11:51











      • this didn't work for me at first; essentially had to do this: brew install --debug --ignore-dependencies raw.githubusercontent.com/Homebrew/homebrew-core/… and once it fails in make html, just ignore the error by selecting 2). the html/docs failure will probably bite me later on, but for now it's working fine :shrug:

        – beans
        Jan 29 at 6:25














      11












      11








      11







      As an update, when doing



      brew unlink python # If you have installed (with brew) another version of python
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


      You may encounter



      Error: python contains a recursive dependency on itself:
      python depends on sphinx-doc
      sphinx-doc depends on python


      To bypass it, add the --ignore-dependencies argument to brew install.



      brew unlink python # If you have installed (with brew) another version of python
      brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb





      share|improve this answer













      As an update, when doing



      brew unlink python # If you have installed (with brew) another version of python
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb


      You may encounter



      Error: python contains a recursive dependency on itself:
      python depends on sphinx-doc
      sphinx-doc depends on python


      To bypass it, add the --ignore-dependencies argument to brew install.



      brew unlink python # If you have installed (with brew) another version of python
      brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jan 22 at 10:22









      FrançoisFrançois

      14327




      14327













      • and then you'll have a nightmare with dependency hell... like discourse.brew.sh/t/brew-install-python3-fails/1756/7

        – confiq
        Jan 23 at 11:51











      • this didn't work for me at first; essentially had to do this: brew install --debug --ignore-dependencies raw.githubusercontent.com/Homebrew/homebrew-core/… and once it fails in make html, just ignore the error by selecting 2). the html/docs failure will probably bite me later on, but for now it's working fine :shrug:

        – beans
        Jan 29 at 6:25



















      • and then you'll have a nightmare with dependency hell... like discourse.brew.sh/t/brew-install-python3-fails/1756/7

        – confiq
        Jan 23 at 11:51











      • this didn't work for me at first; essentially had to do this: brew install --debug --ignore-dependencies raw.githubusercontent.com/Homebrew/homebrew-core/… and once it fails in make html, just ignore the error by selecting 2). the html/docs failure will probably bite me later on, but for now it's working fine :shrug:

        – beans
        Jan 29 at 6:25

















      and then you'll have a nightmare with dependency hell... like discourse.brew.sh/t/brew-install-python3-fails/1756/7

      – confiq
      Jan 23 at 11:51





      and then you'll have a nightmare with dependency hell... like discourse.brew.sh/t/brew-install-python3-fails/1756/7

      – confiq
      Jan 23 at 11:51













      this didn't work for me at first; essentially had to do this: brew install --debug --ignore-dependencies raw.githubusercontent.com/Homebrew/homebrew-core/… and once it fails in make html, just ignore the error by selecting 2). the html/docs failure will probably bite me later on, but for now it's working fine :shrug:

      – beans
      Jan 29 at 6:25





      this didn't work for me at first; essentially had to do this: brew install --debug --ignore-dependencies raw.githubusercontent.com/Homebrew/homebrew-core/… and once it fails in make html, just ignore the error by selecting 2). the html/docs failure will probably bite me later on, but for now it's working fine :shrug:

      – beans
      Jan 29 at 6:25











      0














      To solve this with homebrew, you can temporarily backdate homebrew-core and set the HOMEBREW_NO_AUTO_UPDATE variable to hold it in place:



      cd `brew --repo homebrew/core`
      git checkout f2a764ef944b1080be64bd88dca9a1d80130c558
      export HOMEBREW_NO_AUTO_UPDATE=1
      brew install python


      I don't recommend permanently backdating homebrew-core, as you will miss out on security patches, but it is useful for testing purposes.



      You can also extract old versions of homebrew formulae into your own tap (tap_owner/tap_name) using the brew extract command:



      brew extract python tap_owner/tap_name --version=3.6.5





      share|improve this answer




























        0














        To solve this with homebrew, you can temporarily backdate homebrew-core and set the HOMEBREW_NO_AUTO_UPDATE variable to hold it in place:



        cd `brew --repo homebrew/core`
        git checkout f2a764ef944b1080be64bd88dca9a1d80130c558
        export HOMEBREW_NO_AUTO_UPDATE=1
        brew install python


        I don't recommend permanently backdating homebrew-core, as you will miss out on security patches, but it is useful for testing purposes.



        You can also extract old versions of homebrew formulae into your own tap (tap_owner/tap_name) using the brew extract command:



        brew extract python tap_owner/tap_name --version=3.6.5





        share|improve this answer


























          0












          0








          0







          To solve this with homebrew, you can temporarily backdate homebrew-core and set the HOMEBREW_NO_AUTO_UPDATE variable to hold it in place:



          cd `brew --repo homebrew/core`
          git checkout f2a764ef944b1080be64bd88dca9a1d80130c558
          export HOMEBREW_NO_AUTO_UPDATE=1
          brew install python


          I don't recommend permanently backdating homebrew-core, as you will miss out on security patches, but it is useful for testing purposes.



          You can also extract old versions of homebrew formulae into your own tap (tap_owner/tap_name) using the brew extract command:



          brew extract python tap_owner/tap_name --version=3.6.5





          share|improve this answer













          To solve this with homebrew, you can temporarily backdate homebrew-core and set the HOMEBREW_NO_AUTO_UPDATE variable to hold it in place:



          cd `brew --repo homebrew/core`
          git checkout f2a764ef944b1080be64bd88dca9a1d80130c558
          export HOMEBREW_NO_AUTO_UPDATE=1
          brew install python


          I don't recommend permanently backdating homebrew-core, as you will miss out on security patches, but it is useful for testing purposes.



          You can also extract old versions of homebrew formulae into your own tap (tap_owner/tap_name) using the brew extract command:



          brew extract python tap_owner/tap_name --version=3.6.5






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 10 '18 at 0:09









          Steven PetersSteven Peters

          1011




          1011























              0














              What I did was first I installed python 3.7 brew install python3 then brew unlink python then I installed python 3.6.5 using above link brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb --ignore-dependencies


              After that I ran brew link --overwrite python. Now I have all pythons in the system to create the virtual environments.



              mian@tdowrick2~ $ python --version
              Python 2.7.10
              mian@tdowrick2~ $ python3.7 --version
              Python 3.7.1
              mian@tdowrick2~ $ python3.6 --version
              Python 3.6.5


              To create Python 3.7 virtual environment.



              mian@tdowrick2~ $ virtualenv -p python3.7 env
              Already using interpreter /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
              Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
              New python executable in /Users/mian/env/bin/python3.7
              Also creating executable in /Users/mian/env/bin/python
              Installing setuptools, pip, wheel...
              done.
              mian@tdowrick2~ $ source env/bin/activate
              (env) mian@tdowrick2~ $ python --version
              Python 3.7.1
              (env) mian@tdowrick2~ $ deactivate


              To create Python 3.6 virtual environment



              mian@tdowrick2~ $ virtualenv -p python3.6 env
              Running virtualenv with interpreter /usr/local/bin/python3.6
              Using base prefix '/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6'
              New python executable in /Users/mian/env/bin/python3.6
              Not overwriting existing python script /Users/mian/env/bin/python (you must use /Users/mian/env/bin/python3.6)
              Installing setuptools, pip, wheel...
              done.
              mian@tdowrick2~ $ source env/bin/activate
              (env) mian@tdowrick2~ $ python --version
              Python 3.6.5
              (env) mian@tdowrick2~ $





              share|improve this answer




























                0














                What I did was first I installed python 3.7 brew install python3 then brew unlink python then I installed python 3.6.5 using above link brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb --ignore-dependencies


                After that I ran brew link --overwrite python. Now I have all pythons in the system to create the virtual environments.



                mian@tdowrick2~ $ python --version
                Python 2.7.10
                mian@tdowrick2~ $ python3.7 --version
                Python 3.7.1
                mian@tdowrick2~ $ python3.6 --version
                Python 3.6.5


                To create Python 3.7 virtual environment.



                mian@tdowrick2~ $ virtualenv -p python3.7 env
                Already using interpreter /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
                Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
                New python executable in /Users/mian/env/bin/python3.7
                Also creating executable in /Users/mian/env/bin/python
                Installing setuptools, pip, wheel...
                done.
                mian@tdowrick2~ $ source env/bin/activate
                (env) mian@tdowrick2~ $ python --version
                Python 3.7.1
                (env) mian@tdowrick2~ $ deactivate


                To create Python 3.6 virtual environment



                mian@tdowrick2~ $ virtualenv -p python3.6 env
                Running virtualenv with interpreter /usr/local/bin/python3.6
                Using base prefix '/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6'
                New python executable in /Users/mian/env/bin/python3.6
                Not overwriting existing python script /Users/mian/env/bin/python (you must use /Users/mian/env/bin/python3.6)
                Installing setuptools, pip, wheel...
                done.
                mian@tdowrick2~ $ source env/bin/activate
                (env) mian@tdowrick2~ $ python --version
                Python 3.6.5
                (env) mian@tdowrick2~ $





                share|improve this answer


























                  0












                  0








                  0







                  What I did was first I installed python 3.7 brew install python3 then brew unlink python then I installed python 3.6.5 using above link brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb --ignore-dependencies


                  After that I ran brew link --overwrite python. Now I have all pythons in the system to create the virtual environments.



                  mian@tdowrick2~ $ python --version
                  Python 2.7.10
                  mian@tdowrick2~ $ python3.7 --version
                  Python 3.7.1
                  mian@tdowrick2~ $ python3.6 --version
                  Python 3.6.5


                  To create Python 3.7 virtual environment.



                  mian@tdowrick2~ $ virtualenv -p python3.7 env
                  Already using interpreter /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
                  Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
                  New python executable in /Users/mian/env/bin/python3.7
                  Also creating executable in /Users/mian/env/bin/python
                  Installing setuptools, pip, wheel...
                  done.
                  mian@tdowrick2~ $ source env/bin/activate
                  (env) mian@tdowrick2~ $ python --version
                  Python 3.7.1
                  (env) mian@tdowrick2~ $ deactivate


                  To create Python 3.6 virtual environment



                  mian@tdowrick2~ $ virtualenv -p python3.6 env
                  Running virtualenv with interpreter /usr/local/bin/python3.6
                  Using base prefix '/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6'
                  New python executable in /Users/mian/env/bin/python3.6
                  Not overwriting existing python script /Users/mian/env/bin/python (you must use /Users/mian/env/bin/python3.6)
                  Installing setuptools, pip, wheel...
                  done.
                  mian@tdowrick2~ $ source env/bin/activate
                  (env) mian@tdowrick2~ $ python --version
                  Python 3.6.5
                  (env) mian@tdowrick2~ $





                  share|improve this answer













                  What I did was first I installed python 3.7 brew install python3 then brew unlink python then I installed python 3.6.5 using above link brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb --ignore-dependencies


                  After that I ran brew link --overwrite python. Now I have all pythons in the system to create the virtual environments.



                  mian@tdowrick2~ $ python --version
                  Python 2.7.10
                  mian@tdowrick2~ $ python3.7 --version
                  Python 3.7.1
                  mian@tdowrick2~ $ python3.6 --version
                  Python 3.6.5


                  To create Python 3.7 virtual environment.



                  mian@tdowrick2~ $ virtualenv -p python3.7 env
                  Already using interpreter /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
                  Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
                  New python executable in /Users/mian/env/bin/python3.7
                  Also creating executable in /Users/mian/env/bin/python
                  Installing setuptools, pip, wheel...
                  done.
                  mian@tdowrick2~ $ source env/bin/activate
                  (env) mian@tdowrick2~ $ python --version
                  Python 3.7.1
                  (env) mian@tdowrick2~ $ deactivate


                  To create Python 3.6 virtual environment



                  mian@tdowrick2~ $ virtualenv -p python3.6 env
                  Running virtualenv with interpreter /usr/local/bin/python3.6
                  Using base prefix '/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6'
                  New python executable in /Users/mian/env/bin/python3.6
                  Not overwriting existing python script /Users/mian/env/bin/python (you must use /Users/mian/env/bin/python3.6)
                  Installing setuptools, pip, wheel...
                  done.
                  mian@tdowrick2~ $ source env/bin/activate
                  (env) mian@tdowrick2~ $ python --version
                  Python 3.6.5
                  (env) mian@tdowrick2~ $






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 30 at 15:22









                  Mian Asbat AhmadMian Asbat Ahmad

                  88361842




                  88361842






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51125013%2fhow-can-i-install-a-previous-version-of-python-3-in-macos-using-homebrew%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      QwCmg YXk3v1AneSJ7cQrlKLNjg,D,rQx t,yYsmTeb2Elvvfo6XF,YxLqtyAW0a1U5X
                      lqryVJ9lFqCiyNFSThr,qTKy6bRsZu5mhOxLswouY9uHMhNGYrJJ6PPUOxpJ9 VK 9CFUr5vH5 rBp5G56,CrQb30l1cCZG74sZA

                      Popular posts from this blog

                      A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                      Calculate evaluation metrics using cross_val_predict sklearn

                      Command to identify the expired API token and generates the new token in shell