mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
docs: remove some system Python notes
Signed-off-by: Michael Cho <michael@michaelcho.dev>
This commit is contained in:
parent
cd1f040949
commit
b95777870c
@ -1,14 +1,13 @@
|
|||||||
# Gems, Eggs and Perl Modules
|
# 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:
|
add-ons available to all users:
|
||||||
|
|
||||||
* `/Library/Ruby`
|
* `/Library/Ruby`
|
||||||
* `/Library/Python`
|
|
||||||
* `/Library/Perl`
|
* `/Library/Perl`
|
||||||
|
|
||||||
You need sudo to install to these like so: `sudo gem install`,
|
You need sudo to install to these like so: `sudo gem install`
|
||||||
`sudo easy_install` or `sudo cpan -i`.
|
or `sudo cpan -i`.
|
||||||
|
|
||||||
## Python packages (eggs) without sudo using system Python
|
## Python packages (eggs) without sudo using system Python
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ Homebrew will install the necessary Python 3 version that is needed to make your
|
|||||||
|
|
||||||
## Python 3
|
## 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).
|
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
|
**Important:** Python may be upgraded to a newer version at any time. Consider using a version
|
||||||
@ -68,16 +68,12 @@ The reasoning for this location is to preserve your modules between (minor) upgr
|
|||||||
|
|
||||||
Some formulae provide Python bindings.
|
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
|
## Policy for non-brewed Python bindings
|
||||||
|
|
||||||
These should be installed via `pip install <package>`. To discover, you can use <https://pypi.org/search>.
|
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).
|
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
|
## 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`.
|
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`.
|
||||||
@ -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>
|
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.**
|
## PEP 668 (Python@3.12) and virtual environments
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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).
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user