阿秉哥
2021-08-25 11:20
采纳率: 100%
浏览 270

pyinstaller打包程序在本机运行正常,但在其他电脑上无法运行问题?

环境:win10,python3.8
问题:如题,程序打包后在本机运行正常,但换台机子无法运行。打包时debug设置为True,在两台电脑运行调试结果,可以看出,在其他电脑使用CMD运行调试时,只执行到入口程序就提示“XXX.exe已停止工作,出现了一个问题,导致程序停止工作,如果有可用的解决方案,windows将关闭程序并通知您”。错误提示关闭后,并无其他错误提示,调试代码与正常电脑执行调试是是一样的,没有其他错误,不知道是何原因?

初步排查与win10或win7无关,因为我另一台win7系统(有配置过anaconda环境)也可以正常使用。
本机运行调试代码如下:

D:\setup\cmsdown1.1\dist\cmsmain>cmsmain 
[12068] PyInstaller Bootloader 3.x 
[12068] LOADER: executable is D:\setup\cmsdown1.1\dist\cmsmain\cmsmain.exe 
[12068] LOADER: homepath is D:\setup\cmsdown1.1\dist\cmsmain 
[12068] LOADER: _MEIPASS2 is NULL 
[12068] LOADER: archivename is D:\setup\cmsdown1.1\dist\cmsmain\cmsmain.exe 
[12068] LOADER: No need to extract files to run; setting extractionpath to homepath 
[12068] LOADER: SetDllDirectory(D:\setup\cmsdown1.1\dist\cmsmain) 
[12068] LOADER: Already in the child - running user's code. 
[12068] LOADER: Python library: D:\setup\cmsdown1.1\dist\cmsmain\python38.dll 
[12068] LOADER: Loaded functions from Python library. 
[12068] LOADER: Manipulating environment (sys.path, sys.prefix) 
[12068] LOADER: sys.prefix is D:\setup\cmsdown1.1\dist\cmsmain 
[12068] LOADER: Pre-init sys.path is D:\setup\cmsdown1.1\dist\cmsmain\base_library.zip;D:\setup\cmsdown1.1\dist\cmsmain 
[12068] LOADER: Setting runtime options 
[12068] LOADER: Initializing python 
[12068] LOADER: Overriding Python's sys.path 
[12068] LOADER: Post-init sys.path is D:\setup\cmsdown1.1\dist\cmsmain\base_library.zip;D:\setup\cmsdown1.1\dist\cmsmain 
[12068] LOADER: Setting sys.argv 
[12068] LOADER: setting sys._MEIPASS 
[12068] LOADER: importing modules from CArchive 
[12068] LOADER: extracted struct 
[12068] LOADER: callfunction returned... 
[12068] LOADER: extracted pyimod01_os_path 
[12068] LOADER: callfunction returned... 
[12068] LOADER: extracted pyimod02_archive 
[12068] LOADER: callfunction returned... 
[12068] LOADER: extracted pyimod03_importers 
[12068] LOADER: callfunction returned... 
[12068] LOADER: Installing PYZ archive with Python modules. 
[12068] LOADER: PYZ archive: PYZ-00.pyz 
[12068] LOADER: Running pyiboot01_bootstrap.py 
[12068] LOADER: Running pyi_rth_multiprocessing.py 
[12068] LOADER: Running pyi_rth_pkgres.py 
[12068] LOADER: Running pyi_rth_win32comgenpy.py 
[12068] LOADER: Running pyi_rth__tkinter.py 
[12068] LOADER: Running cms_main.py #此处为打包的入口程序,以下的为其他调用程序。
[12068] LOADER: Running loginPage.py 
[12068] LOADER: Running Browser_os.py 
[12068] LOADER: Running DlPage.py 
[12068] LOADER: Running MainPage.py 
[12068] LOADER: Running frame_downPage.py 
[12068] LOADER: Running Datadown_cms.py 
[12068] LOADER: Running IRBS.py 
[12068] LOADER: Running CallLogger.py 
[12068] LOADER: Running AboutFrame.py 
[12068] LOADER: Running Writer_AutoFit.py 
[12068] LOADER: OK. 
[12068] LOADER: Cleaning up Python interpreter. 

其他电脑运行调试代码如下:

[6552] PyInstaller Bootloader 3.x
[6552] LOADER: executable is D:\cmsmain\cmsmain.exe
[6552] LOADER: homepath is D:\cmsmain
[6552] LOADER: _MEIPASS2 is NULL
[6552] LOADER: archivename is D:\cmsmain\cmsmain.exe
[6552] LOADER: No need to extract files to run; setting extractionpath to homepath
[6552] LOADER: SetDllDirectory(D:\cmsmain)
[6552] LOADER: Already in the child - running user's code.
[6552] LOADER: Python library: D:\cmsmain\python38.dll
[6552] LOADER: Loaded functions from Python library.
[6552] LOADER: Manipulating environment (sys.path, sys.prefix)
[6552] LOADER: sys.prefix is D:\cmsmain
[6552] LOADER: Pre-init sys.path is D:\cmsmain\base_library.zip;D:\cmsmain
[6552] LOADER: Setting runtime options
[6552] LOADER: Initializing python
[6552] LOADER: Overriding Python's sys.path
[6552] LOADER: Post-init sys.path is D:\cmsmain\base_library.zip;D:\cmsmain
[6552] LOADER: Setting sys.argv
[6552] LOADER: setting sys._MEIPASS
[6552] LOADER: importing modules from CArchive
[6552] LOADER: extracted struct
[6552] LOADER: callfunction returned...
[6552] LOADER: extracted pyimod01_os_path
[6552] LOADER: callfunction returned...
[6552] LOADER: extracted pyimod02_archive
[6552] LOADER: callfunction returned...
[6552] LOADER: extracted pyimod03_importers
[6552] LOADER: callfunction returned...
[6552] LOADER: Installing PYZ archive with Python modules.
[6552] LOADER: PYZ archive: PYZ-00.pyz
[6552] LOADER: Running pyiboot01_bootstrap.py
[6552] LOADER: Running pyi_rth_multiprocessing.py
[6552] LOADER: Running pyi_rth_pkgres.py
[6552] LOADER: Running pyi_rth_win32comgenpy.py
[6552] LOADER: Running pyi_rth__tkinter.py
[6552] LOADER: Running cms_main.py #此处为打包的入口程序

调试到此提示错误如下图:
img
程序调用的其他py程序(loginPage.py、Browser_os.py 、DlPage.py、MainPage.py、frame_downPage.py、Datadown_cms.py、IRBS.py、CallLogger.py 、AboutFrame.py、Writer_AutoFit.py)未运行。
本人刚学python不久,请各位指教,谢谢!

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题