python打包exe出错:Struct.error 希望高人能指导下。感谢了

哎呀呀,第一次打包,错误很多。然后一直查百度,解决了很多。
但是还是有几个不知道弄,所以求万能的CSDN,万能的大佬,万能的大神。
救救我这个新手小白吧。
代码如下:
**** import tushare
while 1 ==1:
print("欢迎来到股票行情查询系统")
X=str(input("请输入股票代码:"))
A=X

dateNow=tushare.get_realtime_quotes((A))

name=dateNow.loc[0][0]
price=dateNow.loc[0][3]
high=dateNow.loc[0][4]
low=dateNow.loc[0][5]
volumn=dateNow.loc[0][8]
amount=dateNow.loc[0][9]
openToday=dateNow.loc[0][1]
pre_close=dateNow.loc[0][2]
timee=dateNow.loc[0][30]

print("***",name,"***")
print("股票名:",name,"\n当前价格:",price,"\n最高价:",high,"\n最低价:",low,"\n成交量:",volumn,"\n成价额:",amount,"\n今日开盘价:",openToday,"\n收盘价:",pre_close,"\n时间",timee,)****


打包过程:

**Microsoft Windows [版本 6.1.7601]

版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>cd c:\a

c:\a>pyinstaller -F -i a.ico nema.py

2608 INFO: PyInstaller: 3.4

2608 INFO: Python: 3.7.2

2609 INFO: Platform: Windows-7-6.1.7601-SP1

2610 INFO: wrote c:\a\nema.spec

2611 INFO: UPX is not available.

2612 INFO: Extending PYTHONPATH with paths

['c:\a', 'c:\a']

2612 INFO: checking Analysis

3850 INFO: checking PYZ

4210 INFO: checking PKG

4486 INFO: Bootloader c:\users\administrator\appdata\local\programs\python\pytho

n37-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe

4486 INFO: checking EXE

4487 INFO: Building EXE because EXE-00.toc is non existent

4487 INFO: Building EXE from EXE-00.toc

4505 INFO: SRCPATH [('a.ico', None)]

4506 INFO: Updating icons from ['a.ico'] to C:\Users\ADMINI~1\AppData\Local\Temp

\tmpks35ep37

Traceback (most recent call last):

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\Scripts

\pyinstaller-script.py", line 11, in

load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller__main__.py", line 111, in run

run_build(pyi_config, spec_file, **vars(args))

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller__main__.py", line 63, in run_build

PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\building\build_main.py", line 838, in main

build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'

))

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\building\build_main.py", line 784, in build

exec(text, spec_namespace)

File "", line 32, in

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\building\api.py", line 433, in init

self.__postinit__()

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\building\datastruct.py", line 158, in postinit

self.assemble()

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\building\api.py", line 522, in assemble

icon.CopyIcons(tmpnm, self.icon)

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\utils\win32\icon.py", line 177, in CopyIcons

return CopyIcons_FromIco(dstpath, [srcpath])

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\utils\win32\icon.py", line 134, in CopyIcons_FromIco

for i, f in enumerate(icons):

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\utils\win32\icon.py", line 104, in init

entry.fromfile(file)

File "c:\users\administrator\appdata\local\programs\python\python37-32\lib\sit

e-packages\PyInstaller\utils\win32\icon.py", line 65, in fromfile

self._fields_ = list(struct.unpack(self._format_, data))

struct.error: unpack requires a buffer of 16 bytes**

还有一个.ico的图标

希望能救救我这朵祖国的花朵。

3个回答

打包的时候先不要图标试试,如果能通过的话应该就是你菜单图标有问题

你的图标文件和你的py文件是不是在一起的哦

无图标打包:pyinstaller -D C:\Users\lenovo\Desktop\手机\demo.py --noconsole
换一下路径即可

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问