Size: 1825
Comment:
|
Size: 1592
Comment: Move pipx to another article
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
'''`pip(1)`''' is the primary package management toolchain for Python. Compare to [[Python/Pipx|pipx]]. |
|
Line 9: | Line 11: |
== Forewarning == | == Installation == |
Line 11: | Line 13: |
If running a Linux distribution, the first thing to check is your package manager. This will preempt difficult-to-debug issues with versioning, file permissions, and dependencies. | `pip(1)` is included in all Python installations. |
Line 17: | Line 19: |
== Pip == | == Usage == |
Line 19: | Line 21: |
'''`pip(1)`''' is the built-in tool for installing a Python package, either locally or from a repository such as PyPI. | On [[Linux]] and [[BSD]] distributions, there is typically a better solution for installing Python-based applications. Check your distribution's package manager first. Reasons being: * `pip(1)` installs globally by default, disallowing side-by-side installations of multiple Python applications unless they each use the same versions of all common dependencies * some distributions rely on the specific versions of Python libraries which may be overwritten or upgraded by `pip(1)` |
Line 21: | Line 25: |
There is always a better solution for installing Python libraries. See [[Python/Venv|venv]]. Reasons being: * `pip(1)` installs globally by default, forcing simultaneous upgrade of all programs relying on a module |
|
Line 22: | Line 28: |
Global installation packages can be found in `/usr/lib/python#.#/site-packages`, with executable scripts typically added to `/usr/bin`. | |
Line 23: | Line 30: |
=== Scope === By default, packages are installed globally. This is not a desirable behavior and is maintained by upstream for the sole reason of backwards compatibility. Global packages are found in `/usr/lib/python#.#/site-packages`, with executable scripts typically added to `/usr/bin`. To install a package as a user, add the `--user` flag. Packages installed this way are found in `~/.local/lib/python#.#/site-packages`, with executable scripts added to `~/.local/bin`. |
To force user-only installation of a module or application, add the `--user` flag. Packages installed this way are found in `~/.local/lib/python#.#/site-packages`, with executable scripts added to `~/.local/bin`. |
Line 39: | Line 42: |
---- == Pipx == '''`pipx(1)`''' is a third-party tool modeled after the [[Node]] tool chain. If installing a package as an executable script, consider using `pipx(1)` instead of `pip(1)`. [[Python/SetupFiles|Entry points]] are created as symlinks to [[Python/Venv|virtual environments]], keeping these packages perfectly isolated from the host. Virtual environments created by pipx are found in `~/.local/pipx`, with executable scripts added to `~/.local/bin`. === Configuration === To adjust the location of `pipx(1)`-managed resources, set new locations: {{{ export PIPX_HOME=~/.local/pipx export PIPX_BIN_DIR=~/.local/bin }}} |
Python Pip
pip(1) is the primary package management toolchain for Python. Compare to pipx.
Contents
Installation
pip(1) is included in all Python installations.
Usage
On Linux and BSD distributions, there is typically a better solution for installing Python-based applications. Check your distribution's package manager first. Reasons being:
pip(1) installs globally by default, disallowing side-by-side installations of multiple Python applications unless they each use the same versions of all common dependencies
some distributions rely on the specific versions of Python libraries which may be overwritten or upgraded by pip(1)
There is always a better solution for installing Python libraries. See venv. Reasons being:
pip(1) installs globally by default, forcing simultaneous upgrade of all programs relying on a module
Global installation packages can be found in /usr/lib/python#.#/site-packages, with executable scripts typically added to /usr/bin.
To force user-only installation of a module or application, add the --user flag. Packages installed this way are found in ~/.local/lib/python#.#/site-packages, with executable scripts added to ~/.local/bin.
Configuration
Pip will by default noisily complain about the format of its output. To suppress the complaint without changing the output itself, explicitly set the default behavior:
export PIP_FORMAT=columns