2 3 5 6 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

pipx

pipx is a tool used in Linux that addresses the shortcomings of the popular pip tool. It’s designed to install and run Python applications in isolated environments, making them globally accessible from your terminal. This means you can run Python applications as if they were native Linux commands, without worrying about package version conflicts.

Here’s how pipx works:

  • When installing a package, pipx creates a directory ~/.local/share/pipx/venvs/PACKAGE.
  • It creates or reuses a shared virtual environment that contains the shared packaging library pip in ~/.local/share/pipx/shared/.
  • It ensures the library is updated to its latest version.

The primary use of pipx is to install Python packages and modules from the Python Package Index (PyPI) in such a way that each application you install has its own virtual environment. This prevents conflicts between Python packages installed via pip and those installed via the native package manager.

Here are some example commands for using pipx:

1.) To install a package:

# pipx install <package_name>

For example, to install the package cowsay:

# pipx install cowsay

2.) To install a specific version of a package:

# pipx install package==version

For instance, to install version 1.24.1 of numpy:

# pipx install numpy==1.24.1

3.) To upgrade all installed packages:

# pipx upgrade-all

4.) To upgrade a specific package:

# pipx upgrade package-name

For example, to upgrade the cowsay package:

# pipx upgrade cowsay

5.) To remove a package:

# pipx uninstall package-name

6.) To list all installed packages:

# pipx list

Remember, after installing pipx, you should add it to your $PATH to access it from anywhere in the terminal:

# pipx ensurepath

Then, close and reopen your terminal to apply the changes.

pipx is a handy tool for Python developers and users who want to manage Python applications easily and avoid conflicts with system-wide packages. It’s especially useful when you want to use Python tools that are not packaged for your Linux distribution.

Related Entries

Spread the word: