Installing pip on macOS Sierra

前端 未结 7 1065
执念已碎
执念已碎 2021-01-31 20:11

I\'ve been trying to install pip on macOS sierra via brew, but every time it completes without installing the binaries in /usr/local/Cellar/python/2.7.13/bin.

7条回答
  •  春和景丽
    2021-01-31 20:46

    OK gang, lots of these answers where helpful but none of them got me to the finish line. I am running High Sierra 10.13.4. The problem as documented above is that Brew installs pip in the /usr/local/bin directory but Python is in /usr/bin (although as Carl said, Python3 correctly goes to /usr/local/bin).

    My immediate use case is related to getting the Postgres BigSQL package to install.

    The steps I took are as follows:

    1. Clear out the brew cache $ rm -rf ~/Library/Caches/Homebrew
    2. Clear out the site-packages $ sudo rm -rf /usr/local/lib/python2.7/site-packages
    3. Reinstall Python $ brew reinstall python This pulls down python-3.5.6.high_sierra and put it in /usr/local/bin/python3
    4. But which python still shows /usr/bin/python
    5. The solution is to run brew install python@2 which pulls down python@2-2.7.14_3.high_sierra
    6. Now which python shows the correct path /usr/local/bin/python which is also where all your pip stuff is installed, so now pip will work.
    7. Of course if you have not installed the latest version of pip you should do that too with sudo pip install --upgrade pip

提交回复
热议问题