Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.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 PyInstaller/QtQuick:找不到qmake版本5.x_Python_Pyqt_Pyqt5_Pyinstaller_Qt Quick - Fatal编程技术网

Python PyInstaller/QtQuick:找不到qmake版本5.x

Python PyInstaller/QtQuick:找不到qmake版本5.x,python,pyqt,pyqt5,pyinstaller,qt-quick,Python,Pyqt,Pyqt5,Pyinstaller,Qt Quick,Windows 10、Python 3.5、PyQt5通过Pip安装,pyinstaller 3.2.1也通过Pip安装。我可以制作一个小的PyQt5 qml应用程序,当它在Python下正常运行时运行良好 如果我有一个名为test.py的Python模块,它包含: from PyQt5.QtWidgets import QApplication from PyQt5.QtQuick import QQuickView 并且做: pyinstaller main.py 我得到: 3452 E

Windows 10、Python 3.5、PyQt5通过Pip安装,pyinstaller 3.2.1也通过Pip安装。我可以制作一个小的PyQt5 qml应用程序,当它在Python下正常运行时运行良好

如果我有一个名为test.py的Python模块,它包含:

from PyQt5.QtWidgets import QApplication
from PyQt5.QtQuick import QQuickView
并且做:

pyinstaller main.py
我得到:

3452 ERROR: Could not find qmake version 5.x, make sure PATH is set correctly or try setting QT5DIR.
3452 ERROR: Cannot find QT_INSTALL_QML directory, "qmake -query QT_INSTALL_QML" returned nothing
其次是:

Traceback (most recent call last):
  File "C:\Python35\Scripts\pyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
  File "c:\python35\lib\site-packages\PyInstaller\__main__.py", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\python35\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\python35\lib\site-packages\PyInstaller\building\build_main.py", line 788, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\python35\lib\site-packages\PyInstaller\building\build_main.py", line 734, in build
    exec(text, spec_namespace)
  File "<string>", line 16, in <module>
  File "c:\python35\lib\site-packages\PyInstaller\building\build_main.py", line 212, in __init__
    self.__postinit__()
  File "c:\python35\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
    self.assemble()
  File "c:\python35\lib\site-packages\PyInstaller\building\build_main.py", line 470, in assemble
    module_hook.post_graph()
  File "c:\python35\lib\site-packages\PyInstaller\building\imphook.py", line 409, in post_graph
    self._load_hook_module()
  File "c:\python35\lib\site-packages\PyInstaller\building\imphook.py", line 390, in _load_hook_module
    attr_value = sanitizer_func(attr_value)
  File "c:\python35\lib\site-packages\PyInstaller\building\utils.py", line 466, in format_binaries_and_datas
    src_root_path_or_glob))
FileNotFoundError: Path or glob "Qt" not found or matches no files.
回溯(最近一次呼叫最后一次):
文件“C:\Python35\Scripts\pyinstaller script.py”,第11行,在
加载入口点('PyInstaller==3.2.1','console\u scripts','PyInstaller')()
文件“c:\python35\lib\site packages\PyInstaller\\uuuuu main\uuuuuu.py”,第90行,正在运行
运行构建(pyi\u配置,规范文件,**vars(args))
文件“c:\python35\lib\site packages\PyInstaller\\uuuuuu main\uuuuuuu.py”,第46行,在运行版本中
PyInstaller.building.build\u main.main(pyi\u配置,spec\u文件,**kwargs)
文件“c:\python35\lib\site packages\PyInstaller\building\build\u main.py”,第788行,在main中
构建(specfile,kw.get('distpath'),kw.get('workpath'),kw.get('clean_build'))
文件“c:\python35\lib\site packages\PyInstaller\building\build\u main.py”,第734行,内部版本
exec(文本,规范名称空间)
文件“”,第16行,在
文件“c:\python35\lib\site packages\PyInstaller\building\build\u main.py”,第212行,在\uuu init中__
self.\uuuu postinit\uuuuu()
文件“c:\python35\lib\site packages\PyInstaller\building\datastruct.py”,第161行,在\uu postinit中__
self.assembly()
文件“c:\python35\lib\site packages\PyInstaller\building\build\u main.py”,第470行,汇编
模块\u hook.post\u图()
文件“c:\python35\lib\site packages\PyInstaller\building\imphook.py”,第409行,在post\U图中
自。\加载\挂钩\模块()
文件“c:\python35\lib\site packages\PyInstaller\building\imphook.py”,第390行,在加载钩子模块中
属性值=消毒剂功能(属性值)
文件“c:\python35\lib\site packages\PyInstaller\building\utils.py”,第466行,格式为二进制文件和数据
src_root_path_或_glob))
FileNotFoundError:找不到路径或全局“Qt”或不匹配任何文件。
如果我注释掉test.py(关于QtQuick的那一行)中的第二行,PyInstaller就会成功


我无法使路径指向qmake,因为我的计算机上没有qmake。我真的不明白为什么我需要qmake?

与Python3.4.4和PyQt5 5.5.1(从-我认为这是3.4的最后一个PyQt5)和PyInstaller 3.2.1一起使用,这一切都是现成的

我认为不同之处在于
Lib\site packages\PyQt5
下的PyQt5目录结构在3.4和3.5之间有很大的不同,我想PyInstaller还不能解决这个问题。特别是,Python34在
Lib\site packages\PyQt5
的根目录中有Qt5二进制文件(Qt5Core.dll等),而在Python35中,它们最终隐藏在
Lib\site packages\pyqt\bin
下。还有很多其他的区别

无论如何,简单的答案是使用Python34/PyQt5.5.1。FWIW我有点让它与Python35和最新的PyQt5(5.8.1)一起工作,但这是一个预兆。我已经安装了Python34和Python35,并且在我的Windows路径中(按此顺序)安装了以下内容:

C:\Python35\
C:\Python35\Scripts\
C:\Python35\Lib\site-packages\PyQt5\Qt\bin
C:\Python34\Lib\site-packages\PyQt5
Python34行必须在那里,否则我们会得到
找不到qmake version 5.x
的东西,而
Python35\Lib\site packages\PyQt5\Qt\bin
路径在上面,这似乎使它选择了正确的二进制文件

这样做,pyinstaller报告成功,但当我运行时,我得到一个关于
无法加载库的失败。。。dist\main\qml\QtQuick\Controls\qtquickcontrolsplugin.dll:找不到指定的过程
。这可以通过手动将
Python35\Lib\site packages\PyQt5\Qt\qml\QtQuick\Controls\qtquickcontrolsplugin.dll
复制到
dist\main\qml\QtQuick\Controls
来解决。之后,我的应用程序按预期运行

我还没有找到让pyinstaller自动获取正确qtquickcontrolsplugin.dll的方法


我猜将
C:\Python34\Lib\site packages\PyQt5
留在路径中可能是从Python34中拾取了一些其他错误的文件,如果是这种情况,您可以手动复制这些文件,或者尝试修改路径等,以实现正确的操作,但是在Python34安装程序修复之前,我将一直使用它。

我和你有同样的问题。
但是,今天它使用的是这个补丁:

FWIW我在从pip3和pyinstaller 3.2.1安装的OSX Sierra/Python 3.5/PyQt5上遇到了相同的错误