Fix - zsh: command not found: pip

% pip install nltk

zsh: command not found pip

If you are using the zsh shell on your device (default shell for Mac) and you are trying to install a python module using the pip command and you get the error "zsh: command not found: pip", well there are few things you can try.

Try to make use of pip3 command instead of pip, as pip3 is the package manager for Python 3.x, while pip works with Python 2.x

% pip3 install nltk
fix - zsh pip command not found

Another reason for this error could be that you have not installed pip/pip3 on your device, you can do that by making use of the package manager for your device Operating system type.

Operating SystemPackage ManagerCommand to Install pip3
Ubuntuapt-getsudo apt-get install python3-pip
Debianapt-getsudo apt-get install python3-pip
CentOSyumsudo yum install python3-pip
Fedoradnfsudo dnf install python3-pip
macOSHomebrewbrew install python3 (installs pip3 as well)
brew install pip3
Arch LinuxPacmansudo pacman -S python-pip
Windows-pip is installed with Python setup.

To know if you have pip already installed on your device, you can check that using the command,

% which pip


One reason if you still get the error "zsh: command not found pip" could be that you have not set pip to the zsh profile file.

Open the .zshrc file and add the export "PATH=$PATH:/path/to/pip_or_pip3" and restart your terminal and check.


Have Questions? Post them here!