Various documentation edits

Mostly edits to formatting, grammar, wording for consistency & readability.
This commit is contained in:
EricFromCanada
2018-10-05 17:23:22 -04:00
parent 88837353fb
commit 31dbc4f985
29 changed files with 176 additions and 163 deletions
+8 -5
View File
@@ -4,7 +4,7 @@ This page describes how Python is handled in Homebrew for users. See [Python for
Homebrew should work with any [CPython](https://stackoverflow.com/questions/2324208/is-there-any-difference-between-cpython-and-python) and defaults to the macOS system Python.
Homebrew provides formulae to brew 3.x and a more up-to-date Python 2.7.x.
Homebrew provides formulae to brew Python 3.x and a more up-to-date Python 2.7.x.
**Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur.
@@ -12,6 +12,7 @@ Homebrew provides formulae to brew 3.x and a more up-to-date Python 2.7.x.
Homebrew provides one formula for Python 3.x (`python`) and another for Python 2.7.x (`python@2`).
The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict:
* `python3` points to Homebrew's Python 3.x (if installed)
* `python2` points to Homebrew's Python 2.7.x (if installed)
* `python` points to Homebrew's Python 2.7.x (if installed) otherwise the macOS system Python. Check out `brew info python` if you wish to add Homebrew's 3.x `python` to your `PATH`.
@@ -55,8 +56,8 @@ So, for Python 3.y.z, you'll find it at `/usr/local/lib/python3.y/site-packages`
Python 3.y also searches for modules in:
- `/Library/Python/3.y/site-packages`
- `~/Library/Python/3.y/lib/python/site-packages`
* `/Library/Python/3.y/site-packages`
* `~/Library/Python/3.y/lib/python/site-packages`
Homebrew's `site-packages` directory is first created if (1) any Homebrew formula with Python bindings are installed, or (2) upon `brew install python`.
@@ -69,7 +70,9 @@ Some formulae provide Python bindings. Sometimes a `--with-python` or `--with-py
**Warning!** Python may crash (see [Common Issues](Common-Issues.md)) if 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`, `pygtk`, `pygobject`, `opencv`, `vtk` and `boost-python`).
## Policy for non-brewed Python bindings
These should be installed via `pip install <package>`. To discover, you can use `pip search` or <https://pypi.python.org/pypi>. (**Note:** System Python does not provide `pip`. Follow the [pip documentation](https://pip.readthedocs.io/en/stable/installing/#install-pip) to install it for your system Python if you would like it.)
These should be installed via `pip install <package>`. To discover, you can use `pip search` or <https://pypi.python.org/pypi>.
**Note:** macOS's system Python does not provide `pip`. Follow the [pip documentation](https://pip.readthedocs.io/en/stable/installing/#install-pip) to install it for your system Python if you would like it.
## Brewed Python modules
For brewed Python, modules installed with `pip` or `python 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`.
@@ -83,7 +86,7 @@ CFLAGS=-I$(brew --prefix)/include LDFLAGS=-L$(brew --prefix)/lib pip install <pa
## Virtualenv
**WARNING:** When you `brew install` formulae that provide Python bindings, you should **not be in an active virtual environment**.
Activate the virtualenv *after* you've brewed, or brew in a fresh Terminal window.
Activate the virtualenv *after* you've brewed, or brew in a fresh terminal window.
Homebrew will still install Python modules into Homebrew's `site-packages` and *not* into the virtual environment's site-package.
Virtualenv has a `--system-site-packages` switch to allow "global" (i.e. Homebrew's) `site-packages` to be accessible from within the virtualenv.