2016-01-13 131 views
1

当我在Mac上运行python应用程序时,它显示了许多关于希望“Python.app”接受传入网络连接的对话框。如何在Mac OS X上允许Python.app到防火墙?

即使我允许多次,它一次又一次地显示。

如何让它一次,不再显示?

enter image description here


编辑

我发现这个问题: Add Python to OS X Firewall Options?

我跟着接受的答案做,但最后当我运行codesign -s "My Signing Identity" -f $(which python),它说:

/usr/bin/python: replacing existing signature 
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate: can't create output file: /usr/bin/python.cstemp (Operation not permitted) 
/usr/bin/python: the codesign_allocate helper tool cannot be found or used 

下一步如何做?

+0

(不允许操作)意味着您不允许执行操作 - 具体而言,您不能在/ usr/bin中创建文件,实际上它由root用户拥有。既然你已经禁用了SIP,你应该用'sudo'运行'codesign'。 – Alessandro

回答

2

很明显,El Capitan有一些呼叫System Integrity Protection,阻止任何用户(甚至根)来修改某些操作系统资源。比如在这种情况下的/ usr/bin目录,其中有python可执行文件。若要自行签订的python二进制您可以在恢复模式下重新启动你的Mac(重启按住CMD + R),然后在终端中输入此禁用SIP:

csrutil disable

然后引导回普通OSX,以及按照步骤来自签Python和执行:

codesign -s "My Signing Identity" -f $(which python)

终于重新引导至恢复模式,并重新启用SIP:

csrutil enable

+0

谢谢。如果能以这种方式工作,我会说多么可怕!它看起来像黑客。事实上,我不知道为什么软件(如Python库)不符合系统环境,任何情况下都是友好的。这对普通开发人员不利。 – ithelloworld

+1

发生了什么事情,你正在携带一个来自El Capitan之前的Python版本。你可以做的另一件事是简单地重新安装python用户brew。 看看这个:http://apple.stackexchange.com/questions/209572/how-to-use-pip-after-the-el-capitan-max-os-x-upgrade 而这个:https:// github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/El_Capitan_and_Homebrew.md – Ulises

+0

我试图重启进入恢复模式。但是那需要管理员密码。我可以登录,因为公司的电脑。 – ithelloworld