2016-01-13 126 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