Brew Python 3

broken image
Brew

Question or problem about Python programming:

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

For brewed Python, modules installed with pip3 or python3 setup.py install will be installed to the $ (brew -prefix)/lib/pythonX.Y/site-packages directory (explained above). Executable Python scripts will be in $ (brew -prefix)/bin. Brew Versions (brewv) Manage multiple versions of your Homebrew packages with ease! Homebrew makes this difficult as a design decision, but sometimes old packages need to be installed and we need a way to do so easily. Pipx install brew-versions Or just with pip: python3 -m pip install -user brew-versions Usage.

  1. 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.
  2. Python has been installed as $(brew -prefix)/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. Pointing to `python3`, `python3-config`, `pip3` etc., respectively, have been installed into.
  3. $ brew search python Formulae app-engine-python boost-python3 ipython python-markdown python@3.7 reorder-python-imports boost-python gst-python micropython python-yq python@3.8 wxpython Casks awips-python kk7ds-python-runtime mysql-connector-python If you meant 'python' specifically: It was migrated from homebrew/cask to homebrew/core.

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.

How to solve the problem:

Solution 1:

Short Answer

To make a clean install of Python 3.6.5 use:

Brew Python 3

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

Long Answer

There are two formulas for installing Python with Homebrew: [email protected] 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.

Brew Python 3.9

Solution

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

Or specifically for Python 3

Brew Install Python 3

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

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 ([email protected]) 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.

Solution 2:

As an update, when doing

You may encounter

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

Solution 3:

What I did was first I installed python 3.7

then I installed python 3.6.5 using above link

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

To create Python 3.7 virtual environment.

To create Python 3.6 virtual environment

Solution 4:

I have tried everything but could not make it work. Finally I have used pyenv and it worked directly like a charm.

So having homebrew installed, juste do:

to manage virtualenvs:

See pyenv and pyenv-virtualenv for more info.

EDIT (2019/03/19)

I have found using the pyenv-installer easier than homebrew to install pyenv and pyenv-virtualenv direclty:

To manage python version, either globally:

or locally in a given directory:

Solution 5:

I tried all the answers above to install Python 3.4.4. The installation of python worked, but PIP would not be installed and nothing I could do to make it work. I was using Mac OSX Mojave, which cause some issues with zlib, openssl.

What not to do:

  • Try to avoid using Homebrew for previous version given by the formula Python or Python3.
  • Do not try to compile Python

Solution:

  1. Download the macOS 64-bit installer or macOS 64-bit/32-bit installer: https://www.python.org/downloads/release/python-365/
  2. In previous step, it will download Python 3.6.5, if for example, you want to download Python 3.4.4, replace in the url above python-365 by python-344
  3. Download click on the file you downloaded a GUI installer will open
  4. If you downloaded python-365, after installation, to launch this version of python, you will type in your terminal python365, same thing for pip, it will be pip365

p.s: You don't have to uninstall your other version of Python on your system.

Edit:

I found a much much much better solution that work on MacOSX, Windows, Linux, etc.

  1. It doesn't matter if you have already python installed or not.
  2. Download Anaconda
  3. Once installed, in terminal type: conda init
  4. In terminal,create virtual environment with any python version, for example, I picked 3.4.4: conda create -n [NameOfYour VirtualEnvironment] python=3.4.4
  5. Then, in terminal, you can check all the virtual environment you ahave created with the command: conda info --envs
  6. Then, in terminal, activate the virtual environment of your choice with: conda activate [The name of your virtual environment that was shown with the command at step 5]

Hope this helps!

Latest version

Released:

Manage different versions of homebrew packages

Project description

Manage multiple versions of your Homebrew packages with ease!Homebrew makes this difficult as a design decision, but sometimes old packagesneed to be installed and we need a way to do so easily.

Installation

With pipx

Or just with pip:

Usage

Brew python3

Switch to a specific version:

Installing from taps:

When no bottle is found for taps it will proceed with searching thelocal tap repository for the correct version and installing from the bottledefined in the formula if it exists, otherwise from source.

This is very slow for the main homebrew repository so this behaviour is disabledwhen a bottle for a homebrew-core package cannot be found. You can supplythe option brewv switch --slow ... to perform this search.

Warnings

Proper SHA256 verification is not done when downloading bottles from themain bottle repository. This is because to get the expected SHAs would mean searchingthe huge homebrew-core repository.

While homebrew bottles exist for most operatingsystems, if the bottle is not found then parsing old formulas fails quite oftensince Homebrew updates their code frequently.

Release historyRelease notifications | RSS feed

0.3.3

0.3.2

0.3.1

Python

0.3.0

0.2.2

0.2.1

Brew Python 3

Question or problem about Python programming:

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

For brewed Python, modules installed with pip3 or python3 setup.py install will be installed to the $ (brew -prefix)/lib/pythonX.Y/site-packages directory (explained above). Executable Python scripts will be in $ (brew -prefix)/bin. Brew Versions (brewv) Manage multiple versions of your Homebrew packages with ease! Homebrew makes this difficult as a design decision, but sometimes old packages need to be installed and we need a way to do so easily. Pipx install brew-versions Or just with pip: python3 -m pip install -user brew-versions Usage.

  1. 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.
  2. Python has been installed as $(brew -prefix)/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. Pointing to `python3`, `python3-config`, `pip3` etc., respectively, have been installed into.
  3. $ brew search python Formulae app-engine-python boost-python3 ipython python-markdown python@3.7 reorder-python-imports boost-python gst-python micropython python-yq python@3.8 wxpython Casks awips-python kk7ds-python-runtime mysql-connector-python If you meant 'python' specifically: It was migrated from homebrew/cask to homebrew/core.

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.

How to solve the problem:

Solution 1:

Short Answer

To make a clean install of Python 3.6.5 use:

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

Long Answer

There are two formulas for installing Python with Homebrew: [email protected] 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.

Brew Python 3.9

Solution

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

Or specifically for Python 3

Brew Install Python 3

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

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 ([email protected]) 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.

Solution 2:

As an update, when doing

You may encounter

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

Solution 3:

What I did was first I installed python 3.7

then I installed python 3.6.5 using above link

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

To create Python 3.7 virtual environment.

To create Python 3.6 virtual environment

Solution 4:

I have tried everything but could not make it work. Finally I have used pyenv and it worked directly like a charm.

So having homebrew installed, juste do:

to manage virtualenvs:

See pyenv and pyenv-virtualenv for more info.

EDIT (2019/03/19)

I have found using the pyenv-installer easier than homebrew to install pyenv and pyenv-virtualenv direclty:

To manage python version, either globally:

or locally in a given directory:

Solution 5:

I tried all the answers above to install Python 3.4.4. The installation of python worked, but PIP would not be installed and nothing I could do to make it work. I was using Mac OSX Mojave, which cause some issues with zlib, openssl.

What not to do:

  • Try to avoid using Homebrew for previous version given by the formula Python or Python3.
  • Do not try to compile Python

Solution:

  1. Download the macOS 64-bit installer or macOS 64-bit/32-bit installer: https://www.python.org/downloads/release/python-365/
  2. In previous step, it will download Python 3.6.5, if for example, you want to download Python 3.4.4, replace in the url above python-365 by python-344
  3. Download click on the file you downloaded a GUI installer will open
  4. If you downloaded python-365, after installation, to launch this version of python, you will type in your terminal python365, same thing for pip, it will be pip365

p.s: You don't have to uninstall your other version of Python on your system.

Edit:

I found a much much much better solution that work on MacOSX, Windows, Linux, etc.

  1. It doesn't matter if you have already python installed or not.
  2. Download Anaconda
  3. Once installed, in terminal type: conda init
  4. In terminal,create virtual environment with any python version, for example, I picked 3.4.4: conda create -n [NameOfYour VirtualEnvironment] python=3.4.4
  5. Then, in terminal, you can check all the virtual environment you ahave created with the command: conda info --envs
  6. Then, in terminal, activate the virtual environment of your choice with: conda activate [The name of your virtual environment that was shown with the command at step 5]

Hope this helps!

Latest version

Released:

Manage different versions of homebrew packages

Project description

Manage multiple versions of your Homebrew packages with ease!Homebrew makes this difficult as a design decision, but sometimes old packagesneed to be installed and we need a way to do so easily.

Installation

With pipx

Or just with pip:

Usage

Switch to a specific version:

Installing from taps:

When no bottle is found for taps it will proceed with searching thelocal tap repository for the correct version and installing from the bottledefined in the formula if it exists, otherwise from source.

This is very slow for the main homebrew repository so this behaviour is disabledwhen a bottle for a homebrew-core package cannot be found. You can supplythe option brewv switch --slow ... to perform this search.

Warnings

Proper SHA256 verification is not done when downloading bottles from themain bottle repository. This is because to get the expected SHAs would mean searchingthe huge homebrew-core repository.

While homebrew bottles exist for most operatingsystems, if the bottle is not found then parsing old formulas fails quite oftensince Homebrew updates their code frequently.

Release historyRelease notifications | RSS feed

0.3.3

0.3.2

0.3.1

0.3.0

0.2.2

0.2.1

0.2.0

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for brew-versions, version 0.3.3
Filename, sizeFile typePython versionUpload dateHashes
Filename, size brew_versions-0.3.3-py3-none-any.whl (9.3 kB) File type Wheel Python version py3 Upload dateHashes
Filename, size brew-versions-0.3.3.tar.gz (10.3 kB) File type Source Python version None Upload dateHashes
Close

Hashes for brew_versions-0.3.3-py3-none-any.whl

Hashes for brew_versions-0.3.3-py3-none-any.whl
AlgorithmHash digest
SHA256a09284ce2736f77ecdcc7aa5970b70b0e834ea75891b0bba74703006a136495c
MD5ac1deeb5936b03be9c2c19177e5af821
BLAKE2-256f294cd7334510f3c52fa42375d5287d27900a357138648ac1bd4e9b55a34f914
Close

Hashes for brew-versions-0.3.3.tar.gz

Hashes for brew-versions-0.3.3.tar.gz
AlgorithmHash digest
SHA256c6c2d805ed2192bfbdb62561e2a935f5e7287264bde0bd66ccc609dcfd1ac901
MD5c404c36d9d80ddd11be5234d77666952
BLAKE2-256d6ec7baf9bfb3d4747955f4d455ad6f10d2cc9ac19d1131a46cadbf62ca9d030




broken image