ZSH: command not found: pip

ZSH: command not found: pip

If you're getting the error "zsh: command not found: pip" it means that the pip command is not installed on your system or it is not in your PATH environment variable. To fix this error, you can either install pip using your system's package manager or add the pip binary's location to your PATH environment variable.

To install pip, you can use the following command:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

This will download the get-pip.py script and run it using the python command. This will install pip and all of its dependencies.

Alternatively, if you already have pip installed but it's not in your PATH, you can add the location of the pip binary to your PATH environment variable. The location of the pip binary may vary depending on your system, but it is typically installed in one of the following directories:

  • /usr/local/bin/pip

  • /usr/bin/pip

  • /usr/local/share/pip

To add the pip binary to your PATH, you can use the following steps:

  1. Open your .zshrc file in a text editor. This file is typically located in your home directory (~/.zshrc).

  2. Add the following line to your .zshrc file, replacing <pip-location> with the location of the pip binary on your system:

export PATH="<pip-location>:$PATH"
  1. Save the .zshrc file and run the following command to reload the PATH environment variable:
source ~/.zshrc

After following these steps, you should be able to run the pip command without any errors.

Understanding the "pip command not found" Error

If you're trying to run pip and you see the error "pip command not found," it indicates that your system does not recognize pip as a valid command.

This typically happens because pip isn't installed on your system, or it's installed but not included in your system's PATH.

PATH is a system variable that tells your operating system where to look for executable files. Understanding this error is the first step to resolving it.

Fixing the "bash: pip: command not found" Issue

If you're using the Bash shell and you encounter the "bash: pip: command not found" error, the issue is the same as above: your system doesn't know where to find pip.

The solution involves either installing pip or adding its location to your PATH. You can do this in Bash by editing your .bashrc or .bash_profile files, which are similar to the .zshrc file discussed in the main article.

Common Solutions for "command not found pip"

The "command not found pip" error message is a common one and can occur in various shells (like Bash, Zsh, Fish, etc.) and environments (like Python virtual environments).

There are several ways to resolve this issue, including reinstalling pip, updating your PATH, or using a different method to manage your Python packages, such as conda or pipenv.

How to Deal with "pip not found" Errors

Encountering a "pip not found" error can be frustrating, but there are several strategies to handle it. First, double-check that pip is installed on your system by trying to run it in different contexts (for instance, try it in a new terminal window, or within a Python script).

If pip is installed but not accessible, you might need to adjust your system's PATH, or you might be dealing with a problem related to your Python environment or version.

Resolving "pip command not found mac" on macOS

For macOS users, seeing the "pip command not found" error is not uncommon. This is often because pip is not included in your PATH. You can add it manually, or you can use a tool like Homebrew to manage your Python and pip installations.

Homebrew is a package manager that simplifies the process of installing and updating software on macOS. It's also worth noting that macOS comes with Python 2.7 pre-installed, but pip is associated with Python 3, so you might need to install Python 3 and pip separately to avoid confusion.

What is pip

pip is a package management system for Python that is used to install and manage software packages written in Python. It is a command-line tool that allows users to easily download, install, and manage Python packages from the command line.

Some of the key features of pip include the ability to:

  • Install packages from the Python Package Index (PyPI) and other indexes

  • Install packages from local wheels or source archives

  • Install multiple packages at once

  • Uninstall packages

  • Manage multiple Python versions and environments on the same system

pip is typically installed automatically when you install Python on your system. However, if it is not installed, you can use the instructions in my previous answer to install it manually. Once pip is installed, you can use it to install and manage Python packages on your system.

Useful links:



Related articles

Ruslan Osipov
Written by author: Ruslan Osipov