用pip 更新 numpy, 提示: Operation notpermitted
解决办法:
1.
pipinstall --upgrade --ignore-installednumpy
2. pipinstall --upgrade --user numpy
原因: 是因为os(El Capitan)中加入了新的安全机制SIP(
System IntegrityProtection)
也可以在重启机器的时候command +r 进入恢复模式, 执行csrutil disable 关闭SIP. (不建议)
Anyone can respond to this issue however they want, (playingchicken with Apple over this is like waiting for an updated versionof rsync, in my opinion...) but if you're coming to this threadnow, just know that you can work around this issueby:
1. installing with pip to your user folder *
2. installing with pip and --ignoring-installed *
3. using a virtualenv
4. installing your own python, e.g. with homebrew
And after all of those options? Sure, you can TEMPORARILYdisable SIP during the time you pip upgrade something in the Systemfolder, but then you're also messing with the version Apple expectsto be present. You can even "at your own risk etc. etc." disable,reboot, then enable --without fs to permanently stop just thefilesystem protections. But I don't think you should get used toemploying SIP-related fixes for python package installs, ifanything the SIP-disabling options will go away, not get morelenient, so dealing with this new situation sooner rather thanlater seems wise.
* also then possibly requiring you to employ a .pth file toensure python picks up on your desired lookup order, as previouslymentioned about sys.path
参考: