29
votes

I am attempting to install some Python libraries by executing variations of the following command in Bash:

pip install --user -U numpy

I installed Python3 using Homebrew.

I then get variations of the following message each time:

WARNING: The scripts f2py, f2py3 and f2py3.7 are installed in '/Users/x/Library/Python/3.7/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

How can I fix this issue to avoid problems in the future?

2
Dylan below is correct however it is not a must-do-thing. You can just turn the warning error off if you dont want to add it to the environment path as stated in the warning --no-warn-script-location - Barb
@Barb - good point. If you're using pip to install stuff, having the pip directory on your path is usually a good idea. - Dylan McNamee
For sure! I cant really think of one reason why you wouldn't want to have it in your path - Barb

2 Answers

54
votes

The error message is telling you to add Python 3 to your path.

To do that, use a text editor to open /Users/<you>/.bashrc, and as the very last line add:

export PATH=/Users/<you>/Library/Python/3.8/bin:$PATH

Then you'll need to launch a new Terminal window for those settings to take effect. (you could make it take effect in your current shell by entering the line directly into your shell)

20
votes

Update: As of python 3.8, the following path should be used:

export PATH=/Library/Frameworks/Python.framework/Versions/3.8/bin:$PATH

If you're using bash, you can store this in your /.bashrc
If you're using zsh, you can store this in your /.zshrc