2

I have installed python 2.7 using Homebrew on a Mac OSX 10.11.6 (El Capitan)

$ which python2
/usr/local/bin/python2

$ ls -l /usr/local/bin/python2
/usr/local/bin/python2 -> ../Cellar/python/2.7.14/bin/python2

When trying to install modules with pip2 (such as matplotlib) I get an error message such as:

$ pip2 install matplotlib 

[...]

IOError: [Errno 13] Permission denied: '/Users/massimopinto/Library/Python/2.7/site-packages/six.py'

inspecting the file to which access is apparently denied reveals that the file should be accessible with read+write permissions. If that adds any element, running a sample python script that imports the matplotlib module returns that matplotlib is not installed, while I can see one such module under:

~/Library/Python/2.7/site-packages/matplotlib/

I have probably messed up a previous python 2.7 installation with the installation that I have made using Homebrew. How do I tell python2 that a matplotlib module exist or, better perhaps, get pip2 to function?

  • Do you have write access to ~/Library/Python/2.7/site-packages? – nohillside Jan 3 '18 at 16:10
  • @patrix no, it belonged to root. I had probably sudo installed python via bundle earlier on. Changing ownership with chown brought things back to normal. Thank you. Now matplotlib is indeed installed in ~/Library/Python/2.7/site-packages but python2.7 won't find it when loading the module. That goes off topic here though. – massimopinto Jan 4 '18 at 8:07

You must log in to answer this question.

Browse other questions tagged .