本文主要是介绍pyinstaller打包exe import numpy等问题解决的spec,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、spec书写模板注意 pathex datas hiddenimports的填写。 # -*- mode: python ; coding: utf-8 -*-block_cipher = Nonea = Analysis(['labelImg.py'],pathex=["C:\\Users\\***\\AppData\\Roaming\\Python\\Python37\\site-packages","C:\\Users\\***\\AppData\\Local\\Programs\\Python\\Python37\\Lib\\site-packages"],binaries=[],datas=[("libs/*", "libs"),("C:\\Users\\***\\AppData\\Local\\Programs\\Python\\Python37\\Lib\\site-packages\\numpy","numpy"),("C:\\Users\\***\\AppData\\Roaming\\Python\\Python37\\site-packages\\cv2", "cv2")],hiddenimports=['json', "numbers", "decimal"],hookspath=[],hooksconfig={},runtime_hooks=[],excludes=[],win_no_prefer_redirects=False,win_private_assemblies=False,cipher=block_cipher,noarchive=False) pyz = PYZ(a.pure, a.zipped_data,cipher=block_cipher)exe = EXE(pyz,a.scripts,a.binaries,a.zipfiles,a.datas, [],name='labeltool1',debug=False,bootloader_ignore_signals=False,strip=False,upx=True,upx_exclude=[],runtime_tmpdir=None,console=False,disable_windowed_traceback=False,target_arch=None,codesign_identity=None,entitlements_file=None )
2、numpy c-extenstion的错误,调试后发现numpy19.5以上版本都会报这个错误,重新安装14.5后成功打包。
这篇关于pyinstaller打包exe import numpy等问题解决的spec的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!