尝试在基于homebrew的python 2.7安装中通过pip2安装模块时出错


2

我在Mac OSX 10.11.6(El Capitan)上使用Homebrew安装了python 2.7

$ which python2
/usr/local/bin/python2

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

当尝试使用pip2安装模块(例如matplotlib)时,我收到一条错误消息,例如:

$ pip2 install matplotlib 

[...]

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

检查明显被拒绝访问的文件表明该文件应该具有读/写权限。 如果添加任何元素,运行导入matplotlib模块的示例python脚本会返回未安装matplotlib,而我可以在下面看到一个这样的模块:

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

我可能搞乱了以前使用Homebrew进行安装的python 2.7安装。我怎么告诉python2 matplotlib模块存在,或者更好的是,让pip2运行?


你有写访问权吗? ~/Library/Python/2.7/site-packages
nohillside

@patrix不,它属于root。我可能 sudo 早先通过bundle安装了python。改变所有权 chown 使事情恢复正常。谢谢。现在 matplotlib 确实安装在 ~/Library/Python/2.7/site-packages but python2.7 加载模块时找不到它。尽管如此,这仍然是主题。
massimopinto
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.