cx_Freeze '@rpath/libQtDeclarative.4.dylib':不存在或不是常规文件

Posted

技术标签:

【中文标题】cx_Freeze \'@rpath/libQtDeclarative.4.dylib\':不存在或不是常规文件【英文标题】:cx_Freeze '@rpath/libQtDeclarative.4.dylib': doesn't exist or not a regular filecx_Freeze '@rpath/libQtDeclarative.4.dylib':不存在或不是常规文件 【发布时间】:2017-06-09 23:12:41 【问题描述】:
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages = ["idna","lib","gui","plugins"], excludes = ["Tcl","tcl"]

import sys
base = 'Win32GUI' if sys.platform=='win32' else None

executables = [
Executable('electrum-xvg', base=base, targetName = 'Electrum XVG',icon="electrum.icns")]

setup(name='electrum-xvg',
  version = '1.0',
  description = '',
  options = dict(build_exe = buildOptions),
  executables = executables])

我有上面的 setup.py 文件,我用它来尝试在 OSX Sierra 上构建应用程序。但是当我使用python setup.py bdist_mac 时会引发错误

@rpath/libQtDeclarative.4.dylib
error: can't copy '@rpath/libQtDeclarative.4.dylib': doesn't exist or not a regular file

libQtDeclarative.4.dylib 存在于我的系统上的~/anaconda/envs/pyqtapp/lib 中,但是当我使用otool -D libQtDeclarative.4.dylib 时,它会引发错误,即不存在此类文件,所以我使用了

install_name_tool -id "@rpath/libQtDeclarative.4.dylib" libQtDeclarative.4.dylib

现在在~/anaconda/envs/pyqtapp/lib 中运行otool -D libQtDeclarative.4.dylib 我得到了

libQtDeclarative.4.dylib:
@rpath/libQtDeclarative.4.dylib

但 cx_Freeze 仍然会引发错误

error: can't copy '@rpath/libQtDeclarative.4.dylib': doesn't exist or not a regular file

【问题讨论】:

您的包含声明在哪里? 【参考方案1】:

尝试明确设置包含(相对路径列表):

includefiles = ['README.txt', 'CHANGELOG.txt', 'helpers\uncompress\unRAR.exe', , 'helpers\uncompress\unzip.exe']

【讨论】:

以上是关于cx_Freeze '@rpath/libQtDeclarative.4.dylib':不存在或不是常规文件的主要内容,如果未能解决你的问题,请参考以下文章

Python cx_Freeze 错误“没有名为 'cx_Freeze.util' 的模块”

cx_freeze 错误“cx_Freeze.freezer.ConfigError:没有名为控制台的基础”

cx_freeze 帮助 AssertionError

使用 cx_freeze 后不会出现 QGraphicsPixmapItem

cx_Freeze 'list' 对象没有属性 'items'

cx_Freeze 错误:未提供命令