Size: 1833
Comment:
|
Size: 1827
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 47: | Line 47: |
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/Virtualenv|virtual environments]], keeping these packages perfectly isolated from the host. | 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. |
Python Pip
Contents
Forewarning
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
pip(1) is the built-in tool for installing a Python package, either locally or from a repository such as PyPI.
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.
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
Pipx
pipx(1) is a third-party tool modeled after the NodeJS tool chain.
If installing a package as an executable script, consider using pipx(1) instead of pip(1). Entry points are created as symlinks to 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