2 ms·
Executables from the Python package aren't placed in $PATH because it clashes with the system-provided one. You have to explicitly add /usr/local/opt/python/lib
by soraminazuki 6y ago
Executables from the Python package aren't placed in $PATH because it clashes with the system-provided one. You have to explicitly add /usr/local/opt/python/libexec/bin in $PATH in order to use Homebrew python and pip. Homebrew warns you when you install packages that have these kinds of gotchas at the last stage of "brew install", so you could've avoided all the hassle if you actually read them. Looking at your command history, you've been using the system Python all along, not the Homebrew one.
Install-time warning message:
https://github.com/Homebrew/homebrew-core/blob/087008a4c8cfba1e728db58d936c24fead0de954/Formula/python%403.8.rb#L314-L326 https://github.com/Homebrew/homebrew-core/blob/087008a4c8cfb...
Documentation referenced in the message:
https://docs.brew.sh/Homebrew-and-Python https://docs.brew.sh/Homebrew-and-Python
--
Though not mandatory, you'd also want to add the following to your shell config so that you can have things you install with "pip --user" ready in $PATH:
PATH+="$(/usr/local/opt/libexec/bin/python -c 'import site; print(site.getuserbase())')/bin"
This advice would also apply for Linux, but it's even more important for macOS/Homebrew because otherwise you'd end up messing up /usr/local.