Python – Could not install packages due to a “Environment error :[error 13]: permission denied : ‘usr/local/bin/f2py'”

macosnumpypython

I am trying to install numpy on macOS X but after executing the command pip install numpy I am getting the error:

Environment error :[error 13]: permission denied : 'usr/local/bin/f2py

How do I fix it?

Best Answer

This worked for me.

pip3 install --user package-name  # for Python3
pip install --user package-name   # for Python2

The --user flag tells Python to install in the user home directory. By default it will go to system locations. credit