Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 是否忽略使用Pyinstaller:PyQt4.QtGui.setStyle进行打包?_Python 2.7_Pyqt4_Ubuntu 14.04_Pyinstaller - Fatal编程技术网

Python 2.7 是否忽略使用Pyinstaller:PyQt4.QtGui.setStyle进行打包?

Python 2.7 是否忽略使用Pyinstaller:PyQt4.QtGui.setStyle进行打包?,python-2.7,pyqt4,ubuntu-14.04,pyinstaller,Python 2.7,Pyqt4,Ubuntu 14.04,Pyinstaller,问题: 如何使用Ubuntu 14.04上的Pyinstaller设置我的应用程序的PyQt样式 详细信息: 我已经在Windows上使用pyinstaller打包了一个PyQt4/Python应用程序,它似乎工作得很好,与仅在IDE中运行时没有任何区别。我试图用Ubuntu 14.04重现这个过程,但我有一些问题无法解决 在IDE中运行时,我可以使用以下命令设置PyQt样式: app=QtGui.QApplication(sys.argv) 应用程序设置样式(“sgi”) 不过,在构建过程

问题:

如何使用Ubuntu 14.04上的Pyinstaller设置我的应用程序的PyQt样式

详细信息:

我已经在Windows上使用pyinstaller打包了一个PyQt4/Python应用程序,它似乎工作得很好,与仅在IDE中运行时没有任何区别。我试图用Ubuntu 14.04重现这个过程,但我有一些问题无法解决

在IDE中运行时,我可以使用以下命令设置PyQt样式:

app=QtGui.QApplication(sys.argv)
应用程序设置样式(“sgi”)
不过,在构建过程中会忽略这一点。其他一切都以与Windows构建相同的方式工作,但打包的Ubuntu应用程序与在Ubuntu的IDE中运行时看起来非常不同:

IDE:

Pyinstaller结果:

我正在使用以下方法构建应用程序:

james@james-PC:~$pyinstaller--distpath/path/myApp/tmp--onedir/path/myApp/myApp.spec

我已经使用终端运行了应用程序,以查看是否出现了任何问题,但在应用程序首次加载时,唯一显示的是以下内容:

(myApp:8312):Gtk警告**:无法在模块路径“murrine”中找到主题引擎,

在谷歌上搜索Gtk警告有许多建议的解决方案。每种方法我都试过多次,但都没有成功。从我所读到的内容来看,我也不相信这与我的PyQt setStyle问题有关

为了以防万一,我使用的spec文件如下所示:

# -*- mode: python -*-
block_cipher = None
added_files = [('some/file.txt','.')]
a = Analysis(['/path/myApp.py'],
    pathex=['/home/'],
    binaries=None,
    datas=added_files,
    hiddenimports=['numpy','os','sys','joblib.Parallel','joblib.delayed','scipy.signal.spectrogram','matplotlib','mplwidget','multiprocessing','matplotlib.pyplot','matplotlib.cm','platform','time','ctypes','matplotlib.gridspec','scipy.constants','tkinter','tkFileDialog','myGUI','scipy.interpolate.interp1d','itertools.combinations','pyfftw'],
    hookspath=[],
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_ciper)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_ciper)
exe = EXE(pyz, a.scripts, exclude_binaries=True, name='maApp', debug=False, strip=False, upx=True, console=True)
coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name='myApp')

提前感谢您提供的任何建议或解决方案。

同样发生在Ubuntu 16.04上,您也尝试了hooks-gtk.py,但运气不佳。