双击使用pyinstaller构建的OS X应用程序捆绑包不会打开该应用程序,但可以从捆绑包中运行可执行文件。怎么了?

时间:2018-08-18 13:34:02

标签: python macos pyinstaller app-bundle

当我尝试使用pyinstaller在OS X上构建此app时,该应用程序包不起作用。

从查找程序中双击捆绑包无济于事。

  • 操作系统版本:OS X High Sierra 10.13.6

  • python:3.6.3

  • pyinstaller:3.3.1(也尝试过3.4.dev0 + 380ab20f8)

我按如下所示构建了该应用程序:pyinstaller --windowed mindfulness-at-the-computer-macos.spec

在寻找答案时,我发现了以下信息,但它们并没有太大帮助

为确保问题不在我们的代码中,我尝试构建本文档中概述的简单示例(一直向下滚动代码):

https://pythonhosted.org/PyInstaller/runtime-information.html#run-time-information

这有同样的问题。

我是这样构建的:pyinstaller -w directories.py

当我用python运行它时,我得到了:

python directories.py

we are not frozen
bundle dir is /Users/marieke/myprojects/test
sys.argv[0] is directories.py
sys.executable is /Users/marieke/myprojects/test/venv/bin/python
os.getcwd is /Users/marieke/myprojects/test

当我从/Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS在终端中运行它时

./directories

we are ever so frozen
bundle dir is /Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS
sys.argv[0] is ./directories
sys.executable is /Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS/directories
os.getcwd is /Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS

当我从/Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS在finder中运行它时

/Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS/directories ; exit;

we are ever so frozen
bundle dir is /Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS
sys.argv[0] is /Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS/directories
sys.executable is /Users/marieke/myprojects/test/dist/directories.app/Contents/MacOS/directories
os.getcwd is /Users/marieke

当我双击捆绑软件时,它不会运行。 当我从终端运行open -a directories.app时,它也不运行。

在控制台应用程序中,我仅看到启动服务消息CHECKIN:0x0-0x97097 5878 directories。没什么。

二进制文件的访问权限为-rwxr-xr-x @

Info.plist文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict><key>CFBundleDisplayName</key>
<string>directories</string>
<key>CFBundleName</key>
<string>directories</string>
<key>CFBundleIdentifier</key>
<string>directories</string>
<key>CFBundleExecutable</key>
<string>MacOS/directories</string>
<key>CFBundleIconFile</key>
<string>icon-windowed.icns</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.0</string>
<key>LSBackgroundOnly</key>
<string>0</string>
</dict>
</plist>

有趣的是,直到3个月前,我们才能够建立一个有效的捆绑包。因此,在此期间,显然发生了一些奇怪的事情,我现在还找不到。

非常感谢您的帮助!

0 个答案:

没有答案