Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running `pip` gives 'command not found' after successful Python homebrew install

To preface, I am very bad with the terminal, please be patient with me.

when I run pip I get: zsh: command not found: pip

I have installed Python 2.7.11 with brew, which should allow pip to work When I run echo $PATH I get

/usr/local/sbin /Users/Nicolas/.composer/vendor/bin /Library/Frameworks/Python.framework/Versions/3.4/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin

I notice that /usr/local/bin/ is in there, which I understand is where brew executables are linked to

when I run which -a python I get

/usr/local/bin/python
/usr/bin/python

So-- two Python installs. I'm guessing one is the native OSX one and one is the homebrew install. When I run which python I get

/usr/local/bin/python

So this is the python that gets run when python is called, right? When I run ls -l $(which python) I get

lrwxr-xr-x  1 Nicolas  admin  34 Feb  3 14:26 /usr/local/bin/python -> ../Cellar/python/2.7.11/bin/python

I think this is where the problem is; I notice that there is a /python/2.7.11/libexec folder...

I have also tried brew unlink python && brew link python to no avail

when I try brew list python | grep pip I get a very long list of results

This is probably the most important one

/usr/local/Cellar/python/2.7.11/libexec/pip/pip/__init__.py

I don't know how to proceed from here... I think it has to do with pip being in python/2.7.11/libexec instead of python/2.7.11/bin

I am not familiar with most of this stuff; my understanding of terminal is very limited. I am not sure how to proceed from here. Any and all help is appreciated, thanks.

like image 543
Nic Aguirre Avatar asked Feb 03 '16 20:02

Nic Aguirre


People also ask

How do I fix command not found pip?

Download the get-pip.py file and store it in the same directory as python is installed. Change the current path of the directory in the command line to the path of the directory where the above file exists. Run the command given below: python get-pip.py. Voila! pip is now installed on your system.

Why is Python not recognizing pip?

Reinstall Python to Fix 'Pip' is Not Recognized as an Internal or External Command. This error usually means there's a problem with the Python installation or the system variable PATH is not set up correctly. Try reinstalling Python and all its components to fix the problem.

Why is pip command not found Mac?

Sometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.

How do I fix pip not found in Linux?

The pip: command not found error is raised if you do not have pip installed on your system, or if you've accidentally used the pip command instead of pip3. To solve this error, make sure you have installed both Python 3 and pip3 onto your system.


1 Answers

I ran into this problem myself on OS X. In my case, I finally did a listing of /usr/local/bin, and found that I had links from pip2, pip2.7, pip3, and pip3.6. What I lacked was a link from just pip. I don't know if this is just part of a new standard, or if I was missing something that would select one of the two, or if having both Python 2 and Python 3 installed meant that I didn't get a simple pip command. Either way, running brew doctor didn't reveal or solve any issues.

In this case, just running pip3 or pip2 (instead of pip) seemed to do the trick for me. In my case, I ran pip3 and everything installed and ran as expected.

like image 81
Steve Hollasch Avatar answered Oct 01 '22 01:10

Steve Hollasch