Installing pip on macOS Sierra

前端 未结 7 1024
执念已碎
执念已碎 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:36

    I had this issue and I found this to be the solution. BTW pip isn't installed via brew. It comes with python and python virtualenvs.

    if you type which python without brew install python you'll get the location in /usr/bin/python. That is the system python which we don't want to develop with.

    So i took the following steps. 1) brew install python 2) export PATH="/usr/local/opt/python/libexec/bin:$PATH" place that in your ~/.bash_profile 3) source ~/.bash_profile in your terminal 4) type which python and that should have changed the location to /usr/local/opt/python/libexec/bin/python.

    This will allow you to pip install normally and use the brew version of python.

    Now before high sierra python used to be located in /usr/local/bin but for some reason if you place /usr/local/bin in your paths it automatically points back to /usr/bin, so this is the only solution I have been able to come up with.

    Python3 does not have this issue, if you brew install python3 and type which python3 you'll see that it's located in /usr/local/bin/python3.

提交回复
热议问题