Py2app:不允许操作 [英] Py2app: Operation not permitted
问题描述
我想创建一个名为"dodgeball"的应用程序,我有主脚本(使用pygame)和setup.py脚本.我还需要一个名为ball.bmp的图像.
I want to create an application called 'dodgeball' and I have my main script (which uses pygame), and my setup.py script. I need an image named ball.bmp that I need as well.
在setup.py脚本中,我有以下代码: 从setuptools导入设置
Inside my setup.py script I have the following code: from setuptools import setup
APP = ['dodgeball.py']
DATA_FILES = ["ball.bmp"]
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
每当我尝试使用Terminal中的以下内容制作应用程序时:
Whenever I try to make the application using the following stuff in Terminal:
python setup.py py2app
一切正常
*** creating application bundle: dodgeball ***
然后返回错误:
error: [Errno 1] Operation not permitted: '/Users/**********/Desktop/Dodgeball/dist/dodgeball.app/Contents/MacOS/dodgeball'
如果有帮助,我使用的是Mac OS X El Capitan(10.11).我知道El Capitan和其他Apple更新一样,将拥有可能会破坏此类功能的新软件和功能.
If it helps, I'm on Mac OS X El Capitan (10.11). I'm aware that El Capitan, like any Apple update, will have new software and features that may break stuff like this.
问题
如何解决此错误,然后允许py2app制作功能全面的应用?
How do I fix this error and then allow py2app to make a fully functionable app?
推荐答案
将操作系统升级到OS X El Capitan(10.11.2)后,使用py2app打包应用时出现类似错误:
After I upgraded my operating system to OS X El Capitan (10.11.2), I got similar error when packaging my app using py2app:
*** creating application bundle: MyApp ***
error: [Errno 1] Operation not permitted: '/Users/jake/work/my-app/dist/MyApp.app/Contents/MacOS/MyApp'
我做了一些研究,找到了解决方法:1)禁用SIP; 2)删除Python.framework上的受限文件标志.它为我工作.
I did some research and found a solution: 1) disable SIP; 2) remove restricted file flag on Python.framework. It worked for me.
-
重新启动Mac.
Restart your Mac.
在OS X启动之前,请按住Command + R并保持其按住状态,直到您看到Apple图标和进度条为止.释放.这会引导您进入恢复状态.
Before OS X starts up, hold down Command+R and keep it held down until you see an Apple icon and a progress bar. Release. This boots you into Recovery.
从实用工具"菜单中,选择终端".
From the Utilities menu, select Terminal.
在提示符下键入以下内容:
At the prompt type the following:
csrutil status
csrutil disable
reboot
您可以按照上述步骤重新启用SIP,但可以使用:
You can re-enable SIP by following the above steps, but using:
csrutil enable
参考文献:
- http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/
- http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html
- http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/
- http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html
sudo chflags -R norestricted /System/Library/Frameworks/Python.framework
这篇关于Py2app:不允许操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!