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

docs: remove some system Python notes #16870

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/Gems,-Eggs-and-Perl-Modules.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Gems, Eggs and Perl Modules

On a fresh macOS installation there are three empty directories for
On a fresh macOS installation there are two empty directories for
add-ons available to all users:

* `/Library/Ruby`
* `/Library/Python`
* `/Library/Perl`

You need sudo to install to these like so: `sudo gem install`,
`sudo easy_install` or `sudo cpan -i`.
You need sudo to install to these like so: `sudo gem install`
or `sudo cpan -i`.

## Python packages (eggs) without sudo using system Python

Expand Down
12 changes: 2 additions & 10 deletions docs/Homebrew-and-Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Homebrew will install the necessary Python 3 version that is needed to make your

## Python 3

Homebrew provides formulae for the newest and maintained releases of Python 3 (`python@3.y`) (https://devguide.python.org/versions/).
Homebrew provides formulae for the newest and maintained releases of Python 3 (`python@3.y`) (<https://devguide.python.org/versions/>).
We keep older `python@3.y` versions according to our [versioned formulae guidelines](https://docs.brew.sh/Versions).

**Important:** Python may be upgraded to a newer version at any time. Consider using a version
Expand Down Expand Up @@ -68,16 +68,12 @@ The reasoning for this location is to preserve your modules between (minor) upgr

Some formulae provide Python bindings.

**Warning!** Python may crash (see [Common Issues](Common-Issues.md)) when you `import <module>` from a brewed Python if you ran `brew install <formula_with_python_bindings>` against the system Python. If you decide to switch to the brewed Python, then reinstall all formulae with Python bindings (e.g. `pyside`, `wxwidgets`, `pyqt`, `pygobject3`, `opencv`, `vtk` and `boost-python`).

## Policy for non-brewed Python bindings

These should be installed via `pip install <package>`. To discover, you can use <https://pypi.org/search>.

Starting with Python 3.12, we highly recommend you to use a separate virtualenv for this (see the section about [PEP 668](https://peps.python.org/pep-0668/#marking-an-interpreter-as-using-an-external-package-manager) below).

**Note:** macOS's system Python does not provide `pip`. Follow the [pip documentation](https://pip.pypa.io/en/stable/installation/) to install it for your system Python if you would like it.

## Brewed Python modules

For brewed Python, modules installed with `pip` 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`.
Expand All @@ -88,11 +84,7 @@ 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>
```

**Warning!** When you `brew install` formulae that provide Python bindings, you should **not be in an active virtual environment.**

Activate the virtualenv *after* you have installed your package with brew, or install brew's packages in a fresh terminal window. This will ensure Python modules are installed into Homebrew's `site-packages` and *not* into that of the virtual environment.

## PEP 668 (Python@3.12) and virtualenvs
## PEP 668 (Python@3.12) 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).

Expand Down