Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"

Sid Mehta picture Sid Mehta · Jun 12, 2018 · Viewed 210k times · Source

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?

Answer

SolitaryReaper picture SolitaryReaper · Jun 17, 2018

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