% 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

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 System | Package Manager | Command to Install pip3 |
|---|---|---|
| Ubuntu | apt-get | sudo apt-get install python3-pip |
| Debian | apt-get | sudo apt-get install python3-pip |
| CentOS | yum | sudo yum install python3-pip |
| Fedora | dnf | sudo dnf install python3-pip |
| macOS | Homebrew | brew install python3 (installs pip3 as well)
brew install pip3 |
| Arch Linux | Pacman | sudo 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
/opt/homebrew/bin/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.
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!