1

I had some trouble with the Python pip package manager, so I uninstalled it using

sudo pip uninstall pip

after which I reinstalled it again:

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

It installed without any errors, so I tried installing a package:

$ sudo pip install flask
sudo: pip: command not found

Apparently something went wrong. So to find out if it installed correctly I first looked up my site-packages folder:

>>> import site; print site.getsitepackages()[0]
/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

and then I had a look in that site-packages folder:

$ cd /usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
$ ls -l | grep pip
drwxr-xr-x   34 kramer65  admin    1156 Aug 13 21:02 pip
drwxr-xr-x   10 kramer65  admin     340 Aug 13 21:02 pip-9.0.1.dist-info

So I think pip is installed correctly in the site-packages folder, but why is the pip command not linked to that anymore?

[EDIT]

Ok, following the tip of @OliverCharlesworth in the comments I reinstalled Python as a whole, but now pip is still not working. So I reinstalled it again:

wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py

it all installs fine, and I can do an import pip in Python. The big problem is however, that the command pip is not linked to the installed pip code.

Does anybody know how I can link the pip command to the installed pip code?

I guess I just need to add a symlink somewhere, but I'm unsure where it should point..

kramer65
  • 50,427
  • 120
  • 308
  • 488
  • `pip` comes with Python if you installed the latter with Homebrew. I'm not quite sure what kind of mess you've got into here (because you've essentially manually installed it on top of the Homebrew installation), so maybe the easiest thing to do is `brew uninstall python && brew install python`? – Oliver Charlesworth Aug 13 '17 at 19:28
  • Did you do it on the right version of python? – Luke Aug 13 '17 at 19:31
  • Have you seen [this](https://stackoverflow.com/questions/17271319/how-do-i-install-pip-on-macos-or-os-x) SO question? (also possible dupe) Do any of the solutions discussed there help? – ForceBru Aug 13 '17 at 19:31
  • @OliverCharlesworth - But won't that also uninstall all packages that I've got installed in Python? I've got quite some packages which involved compiling (cv2) and I would preferably like to avoid installing all those packages again. – kramer65 Aug 13 '17 at 19:37
  • Yes, that would the downside :( However, it may well end up being the easiest thing in this scenario, rather than trying to patch up whatever the underlying problem is here (the fact that you needed to uninstall Pip in the first place is already an indication that things are severely messed up here!). – Oliver Charlesworth Aug 13 '17 at 19:39
  • @OliverCharlesworth - I just reinstalled Python, and now Python doesn't work anymore either. Check out my edited question. Any idea? – kramer65 Aug 13 '17 at 20:13
  • It sounds like your PATH may be pretty messed up. What does `brew doctor` say? – Oliver Charlesworth Aug 13 '17 at 20:14
  • Why do you even use `brew`? I mean, there's a macOS installer on the Python's official site. – ForceBru Aug 13 '17 at 20:15
  • @ForceBru - IMO, using a centralised package manager like `brew` is considerably more convenient than having to manually download something from a site, and then having to figure out how to upgrade/downgrade/uninstall in the future. – Oliver Charlesworth Aug 13 '17 at 20:48
  • @OliverCharlesworth - I reinstalled Python using brew and after some trouble that works again. But pip is still not working. `brew doctor` says a lot, so I made a paste here: https://pastebin.com/7eLXwvKb Do you have any other ideas? – kramer65 Aug 13 '17 at 20:52

0 Answers0