【原创】Mac os pip install error: Operation not permitted

用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

参考: 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值