pyinstaller部署的exe文件不能在另一台电脑(虚拟机)上运行
exe file deployed by pyinstaller can not run on another pc(virtual machine)
开发机:
- windows7 64 位
- python2.7.13 32位
- Qt5.7.1 32bit vs2015 + PyQt5_gpl-5.7.1
- pyinstaller,pip 安装https://github.com/pyinstaller/pyinstaller/archive/develop.zip
我使用 pyinstaller qrprint.py
部署,在这台机器上运行良好。
然后我将文件夹复制到虚拟机(vmware 工作站 + winowd7 32 位)和 运行,它不适用于信息 Failed to execute script pyi_rth_qt5
我尝试搜索解决方案,比如https://github.com/pyinstaller/pyinstaller/issues/1679,它没有帮助。
我用DependencyWalker
发现缺少dll,不能用
这是pyinstaller qrprint.py --debug
两台机器上的信息
开发:
PyInstaller Bootloader 3.x
LOADER: executable is C:\Users\Administrator\Desktop\python demo\dist\qrPrint\qrPrint.exe
LOADER: homepath is C:\Users\Administrator\Desktop\python demo\dist\qrPrint
LOADER: _MEIPASS2 is NULL
LOADER: archivename is C:\Users\Administrator\Desktop\python demo\dist\qrPrint\qrPrint.exe
LOADER: No need to extract files to run; setting extractionpath to homepath
LOADER: SetDllDirectory(C:\Users\Administrator\Desktop\python demo\dist\qrPrint)
LOADER: Already in the child - running user's code.
LOADER: Python library: C:\Users\Administrator\Desktop\python demo\dist\qrPrint\python27.dll
LOADER: Loaded functions from Python library.
LOADER: Manipulating environment (sys.path, sys.prefix)
LOADER: sys.prefix is C:\Users\ADMINI~1\Desktop\PYTHON~1\dist\qrPrint
LOADER: Setting runtime options
LOADER: Initializing python
LOADER: Overriding Python's sys.path
LOADER: Post-init sys.path is C:\Users\Administrator\Desktop\python demo\dist\qrPrint
LOADER: Setting sys.argv
LOADER: setting sys._MEIPASS
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: callfunction returned...
LOADER: extracted pyimod01_os_path
LOADER: callfunction returned...
LOADER: extracted pyimod02_archive
LOADER: callfunction returned...
LOADER: extracted pyimod03_importers
LOADER: callfunction returned...
LOADER: Installing PYZ archive with Python modules.
LOADER: PYZ archive: out00-PYZ.pyz
LOADER: Running pyiboot01_bootstrap.py
LOADER: Running pyi_rth__tkinter.py
LOADER: Running pyi_rth_qt5.py
LOADER: Running pyi_rth_qt5plugins.py
LOADER: Running qrPrint.py
虚拟机:
PyInstaller Bootloader 3.x
LOADER: executable is C:\Users\Administrator\Desktop\qrPrint\qrPrint.exe
LOADER: homepath is C:\Users\Administrator\Desktop\qrPrint
LOADER: _MEIPASS2 is NULL
LOADER: archivename is C:\Users\Administrator\Desktop\qrPrint\qrPrint.exe
LOADER: No need to extract files to run; setting extractionpath to homepath
LOADER: SetDllDirectory(C:\Users\Administrator\Desktop\qrPrint)
LOADER: Already in the child - running user's code.
LOADER: Python library: C:\Users\Administrator\Desktop\qrPrint\python27.dll
LOADER: Loaded functions from Python library.
LOADER: Manipulating environment (sys.path, sys.prefix)
LOADER: sys.prefix is C:\Users\ADMINI~1\Desktop\qrPrint
LOADER: Setting runtime options
LOADER: Initializing python
LOADER: Overriding Python's sys.path
LOADER: Post-init sys.path is C:\Users\Administrator\Desktop\qrPrint
LOADER: Setting sys.argv
LOADER: setting sys._MEIPASS
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: callfunction returned...
LOADER: extracted pyimod01_os_path
LOADER: callfunction returned...
LOADER: extracted pyimod02_archive
LOADER: callfunction returned...
LOADER: extracted pyimod03_importers
LOADER: callfunction returned...
LOADER: Installing PYZ archive with Python modules.
LOADER: PYZ archive: out00-PYZ.pyz
LOADER: Running pyiboot01_bootstrap.py
LOADER: Running pyi_rth__tkinter.py
LOADER: Running pyi_rth_qt5.py
Traceback (most recent call last):
File "site-packages\PyInstaller\loader\rthooks\pyi_rth_qt5.py", line 56, in <m
odule>
File "c:\dvlp\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers
.py", line 546, in load_module
ImportError: DLL load failed: 找不到指定的模块。
Failed to execute script pyi_rth_qt5
LOADER: OK.
LOADER: Cleaning up Python interpreter.
我该怎么办?
找到原因了。太蠢了,忘了安装 vc runtime libiray。
安装后效果很好
但我无法在 XP 上工作,我认为原因是 Qt5.7.1 msvc 2015 不支持 XP。
如何从支持 XP 的 Qt5.7.1 编译 PyQt5 是另一个问题。
开发机:
- windows7 64 位
- python2.7.13 32位
- Qt5.7.1 32bit vs2015 + PyQt5_gpl-5.7.1
- pyinstaller,pip 安装https://github.com/pyinstaller/pyinstaller/archive/develop.zip
我使用 pyinstaller qrprint.py
部署,在这台机器上运行良好。
然后我将文件夹复制到虚拟机(vmware 工作站 + winowd7 32 位)和 运行,它不适用于信息 Failed to execute script pyi_rth_qt5
我尝试搜索解决方案,比如https://github.com/pyinstaller/pyinstaller/issues/1679,它没有帮助。
我用DependencyWalker
发现缺少dll,不能用
这是pyinstaller qrprint.py --debug
开发:
PyInstaller Bootloader 3.x
LOADER: executable is C:\Users\Administrator\Desktop\python demo\dist\qrPrint\qrPrint.exe
LOADER: homepath is C:\Users\Administrator\Desktop\python demo\dist\qrPrint
LOADER: _MEIPASS2 is NULL
LOADER: archivename is C:\Users\Administrator\Desktop\python demo\dist\qrPrint\qrPrint.exe
LOADER: No need to extract files to run; setting extractionpath to homepath
LOADER: SetDllDirectory(C:\Users\Administrator\Desktop\python demo\dist\qrPrint)
LOADER: Already in the child - running user's code.
LOADER: Python library: C:\Users\Administrator\Desktop\python demo\dist\qrPrint\python27.dll
LOADER: Loaded functions from Python library.
LOADER: Manipulating environment (sys.path, sys.prefix)
LOADER: sys.prefix is C:\Users\ADMINI~1\Desktop\PYTHON~1\dist\qrPrint
LOADER: Setting runtime options
LOADER: Initializing python
LOADER: Overriding Python's sys.path
LOADER: Post-init sys.path is C:\Users\Administrator\Desktop\python demo\dist\qrPrint
LOADER: Setting sys.argv
LOADER: setting sys._MEIPASS
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: callfunction returned...
LOADER: extracted pyimod01_os_path
LOADER: callfunction returned...
LOADER: extracted pyimod02_archive
LOADER: callfunction returned...
LOADER: extracted pyimod03_importers
LOADER: callfunction returned...
LOADER: Installing PYZ archive with Python modules.
LOADER: PYZ archive: out00-PYZ.pyz
LOADER: Running pyiboot01_bootstrap.py
LOADER: Running pyi_rth__tkinter.py
LOADER: Running pyi_rth_qt5.py
LOADER: Running pyi_rth_qt5plugins.py
LOADER: Running qrPrint.py
虚拟机:
PyInstaller Bootloader 3.x
LOADER: executable is C:\Users\Administrator\Desktop\qrPrint\qrPrint.exe
LOADER: homepath is C:\Users\Administrator\Desktop\qrPrint
LOADER: _MEIPASS2 is NULL
LOADER: archivename is C:\Users\Administrator\Desktop\qrPrint\qrPrint.exe
LOADER: No need to extract files to run; setting extractionpath to homepath
LOADER: SetDllDirectory(C:\Users\Administrator\Desktop\qrPrint)
LOADER: Already in the child - running user's code.
LOADER: Python library: C:\Users\Administrator\Desktop\qrPrint\python27.dll
LOADER: Loaded functions from Python library.
LOADER: Manipulating environment (sys.path, sys.prefix)
LOADER: sys.prefix is C:\Users\ADMINI~1\Desktop\qrPrint
LOADER: Setting runtime options
LOADER: Initializing python
LOADER: Overriding Python's sys.path
LOADER: Post-init sys.path is C:\Users\Administrator\Desktop\qrPrint
LOADER: Setting sys.argv
LOADER: setting sys._MEIPASS
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: callfunction returned...
LOADER: extracted pyimod01_os_path
LOADER: callfunction returned...
LOADER: extracted pyimod02_archive
LOADER: callfunction returned...
LOADER: extracted pyimod03_importers
LOADER: callfunction returned...
LOADER: Installing PYZ archive with Python modules.
LOADER: PYZ archive: out00-PYZ.pyz
LOADER: Running pyiboot01_bootstrap.py
LOADER: Running pyi_rth__tkinter.py
LOADER: Running pyi_rth_qt5.py
Traceback (most recent call last):
File "site-packages\PyInstaller\loader\rthooks\pyi_rth_qt5.py", line 56, in <m
odule>
File "c:\dvlp\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers
.py", line 546, in load_module
ImportError: DLL load failed: 找不到指定的模块。
Failed to execute script pyi_rth_qt5
LOADER: OK.
LOADER: Cleaning up Python interpreter.
我该怎么办?
找到原因了。太蠢了,忘了安装 vc runtime libiray。 安装后效果很好
但我无法在 XP 上工作,我认为原因是 Qt5.7.1 msvc 2015 不支持 XP。
如何从支持 XP 的 Qt5.7.1 编译 PyQt5 是另一个问题。