pip in path but command not found

692 Views Asked by At

I'm running a fresh installed OctoPi image (0.18.0). I added pip to my PATH in .bashrc file and sourced it but when I try to run pip I'm getting -bash: pip: command not found error.

When I run /home/pi/oprint/bin/pip, pip is working properly.

My path:

pi@octopi:~ $ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/home/pi/oprint/bin/pip:
2

There are 2 best solutions below

1
On BEST ANSWER

You added the full path of the executable to the path, but you're only supposed to add the directory of the executable. Every exectuable of said directory is then directly available without the directory prefix.

In other words .. instead of /home/pi/oprint/bin/pip you should add /home/pi/oprint/bin/ to the path.

2
On

I always recommend using the Python executable to locate the pip executable for you. This way, you know the right version of pip is being used to install packages that are compliant with your Python version.

$ python -m pip install <the_package_you_want>

It is really easy to end up with mismatched versions otherwise!