MacOS – No commands installed from pip work in Terminal

bashcommand linemacospythonterminal

I've been learning python and tried to install pep8, restviewer and other command line apps but when i try to run them, it shows a command not found error.

-bash: restview: command not found

I've tried it in zsh and other shells, but no avail. I've even tried it as a root user. I've reset my PATH and executed the bash shell's again but it still couldn't recognise my errors. I've also reinstalled Xcode to make sure my command line tools were present. How to i fix this?

Best Answer

I would comment, but I don't have enough coinage. We need to figure out what is wrong:

The packages do not exist in a known path that you have. We know this. So what is causing it? Either it's not being installed, or it is being installed and the binary is not in PATH.

First, make sure it is being installed properly by pip. Do a pip install and let us know the output. Also let us know the output of pip list after the install. I just went to console, switched to a virtual environment, then did a pip install on restview. It installed successfully in virtual_env_path/bin/ and also my pip is located in virtual_env_path/bin/

So, if it is installing correctly I would find out where pip is located by typing which pip

Then see if the packages you are looking for are in that path, or near there. Clearly, that directory is in your path since pip runs. If you find the packages, make sure that directory is added to the path if they are not. Remember PATH resets each time you open a new console. Check path via echo $PATH

Basically, if it is installed, you must find out where, then compare that to your path. Good luck.