Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homebrew-and-Python: more PEP 668 guidance #17922

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs/Homebrew-and-Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ $(brew --prefix python)/libexec/bin

The Python formulae install [pip](https://pip.pypa.io/) (as `pip3`). [email protected] and older Python formulae also install [Setuptools](https://pypi.org/project/setuptools/).

Starting with [email protected], the bundled Python packages should be updated by reinstalling brewed Python. For older Python formulae, they can be updated as described below.
Starting with Python 3.12, the bundled Python packages should be updated by reinstalling brewed Python. For older Python formulae, they can be updated as described below.

**Warning!** The steps below **do not work** for Homebrew's Python 3.12 or newer. If you need a newer version of `pip` or `setuptools` than comes with the Homebrewed Python, you **must** use a virtual environment or other isolation mechanism [per below](#pep-668-and-virtual-environments).

Setuptools can be updated via `pip`, without having to reinstall brewed Python:

Expand Down Expand Up @@ -84,9 +86,9 @@ Since the system Python may not know which compiler flags to set when building b
CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib" pip install <package>
```

## PEP 668 ([email protected]) and virtual environments
## PEP 668 and virtual environments

Starting with Python@3.12, Homebrew follows [PEP 668](https://peps.python.org/pep-0668/#marking-an-interpreter-as-using-an-external-package-manager).
Starting with Python 3.12, Homebrew follows [PEP 668](https://peps.python.org/pep-0668/#marking-an-interpreter-as-using-an-external-package-manager).

If you wish to install a non-brew-packaged Python package (from PyPI for example):

Expand Down
Loading