gpt4 book ai didi

python - 如何在 Mac OS X 上允许 Python.app 通过防火墙?

转载 作者:行者123 更新时间:2023-12-02 00:01:17 29 4
gpt4 key购买 nike

当我在 Mac 上运行 python 应用程序时,它会显示许多关于希望“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

下一步怎么办?

最佳答案

With the OS X firewall enabled, you can remove the "Do you want the application "python" to accept incoming network connections?" message.

Create a self-signed certificate.

Open Keychain Access. Applications > Utilities > Keychain Access.
Keychain Access menu > Certificate Assistant > Create a Certificate...
Enter a Name like "My Certificate".
Select Identity Type: Self Signed Root
Select Certificate Type: Code Signing
Check the Let me override defaults box
Click Continue
Enter a unique Serial Number
Enter 7300 for Validity Period.
Click Continue
Click Continue for the rest of the dialogs
Now sign your application

codesign -s "My Certificate" -f $(which python)

In the dialog that appears, click "Allow".

Note that when using a virtual environment, you need to activate the virtual environment before running this command.

关于python - 如何在 Mac OS X 上允许 Python.app 通过防火墙?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34760163/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com