muzuiget / niconvert

弹幕转换工具
255 stars 33 forks source link

打包成exe文件可在无Python环境下的电脑使用 #30

Closed RainySY closed 3 years ago

RainySY commented 3 years ago

作者你好,我想询问一下如何将该程序打包成exe可执行程序 我现在使用的 pyinstaller 在打包好之后执行程序会出现以下问题 image 无法正常使用 打包命令测试过以下这些

pyinstaller -D main.pyw
pyinstaller --hidden-import=queue -w -F main.py

这些 所以我现在想询问一下该如何打包 PS:我的Python基础很差,所以很多基础的东西我可能没有查询到 另附一份打包时的Log

64 INFO: PyInstaller: 4.2
65 INFO: Python: 3.9.2
66 INFO: Platform: Windows-10-10.0.18362-SP0
67 INFO: wrote C:\Users\chen\Downloads\niconvert-master\niconvert-master\main.spec
69 INFO: UPX is not available.
71 INFO: Extending PYTHONPATH with paths
['C:\\Users\\chen\\Downloads\\niconvert-master\\niconvert-master',
 'C:\\Users\\chen\\Downloads\\niconvert-master\\niconvert-master']
95 INFO: checking Analysis
95 INFO: Building Analysis because Analysis-00.toc is non existent
97 INFO: Initializing module dependency graph...
99 INFO: Caching module graph hooks...
108 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
112 INFO: Analyzing base_library.zip ...
4008 INFO: Processing pre-find module path hook distutils from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
4010 INFO: distutils: retargeting to non-venv dir 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib'
7271 INFO: Caching module dependency graph...
7381 INFO: running Analysis Analysis-00.toc
7396 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\chen\appdata\local\programs\python\python39\python.exe
7480 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\users\chen\appdata\local\programs\python\python39\python39.dll
7499 INFO: Analyzing C:\Users\chen\Downloads\niconvert-master\niconvert-master\main.pyw
7820 INFO: Processing module hooks...
7821 INFO: Loading module hook 'hook-difflib.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7823 INFO: Excluding import of doctest from module difflib
7824 INFO: Loading module hook 'hook-distutils.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7830 INFO: Loading module hook 'hook-distutils.util.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7832 INFO: Excluding import of lib2to3.refactor from module distutils.util
7832 INFO: Loading module hook 'hook-encodings.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7918 INFO: Loading module hook 'hook-heapq.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7921 INFO: Excluding import of doctest from module heapq
7921 INFO: Loading module hook 'hook-lib2to3.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7962 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7963 INFO: Excluding import of test from module multiprocessing.util
7963 INFO: Excluding import of test.support from module multiprocessing.util
7965 INFO: Loading module hook 'hook-pickle.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7967 INFO: Excluding import of argparse from module pickle
7967 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7968 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
7969 INFO: Loading module hook 'hook-xml.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
8034 INFO: Loading module hook 'hook-_tkinter.py' from 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
8194 INFO: checking Tree
8194 INFO: Building Tree because Tree-00.toc is non existent
8195 INFO: Building Tree Tree-00.toc
8261 INFO: checking Tree
8262 INFO: Building Tree because Tree-01.toc is non existent
8263 INFO: Building Tree Tree-01.toc
8342 INFO: checking Tree
8342 INFO: Building Tree because Tree-02.toc is non existent
8343 INFO: Building Tree Tree-02.toc
8370 INFO: Looking for ctypes DLLs
8407 INFO: Analyzing run-time hooks ...
8412 INFO: Including run-time hook 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
8415 INFO: Including run-time hook 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_win32api.py'
8419 INFO: Including run-time hook 'c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth__tkinter.py'
8425 INFO: Looking for dynamic libraries
8837 INFO: Looking for eggs
8837 INFO: Using Python library c:\users\chen\appdata\local\programs\python\python39\python39.dll
8839 INFO: Found binding redirects:
[]
8844 INFO: Warnings written to C:\Users\chen\Downloads\niconvert-master\niconvert-master\build\main\warn-main.txt
8896 INFO: Graph cross-reference written to C:\Users\chen\Downloads\niconvert-master\niconvert-master\build\main\xref-main.html
8939 INFO: checking PYZ
8939 INFO: Building PYZ because PYZ-00.toc is non existent
8940 INFO: Building PYZ (ZlibArchive) C:\Users\chen\Downloads\niconvert-master\niconvert-master\build\main\PYZ-00.pyz
9646 INFO: Building PYZ (ZlibArchive) C:\Users\chen\Downloads\niconvert-master\niconvert-master\build\main\PYZ-00.pyz completed successfully.
9657 INFO: checking PKG
9657 INFO: Building PKG because PKG-00.toc is non existent
9658 INFO: Building PKG (CArchive) PKG-00.pkg
9675 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
9677 INFO: Bootloader c:\users\chen\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
9677 INFO: checking EXE
9678 INFO: Building EXE because EXE-00.toc is non existent
9678 INFO: Building EXE from EXE-00.toc
9681 INFO: Copying icons from ['c:\\users\\chen\\appdata\\local\\programs\\python\\python39\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-windowed.ico']
9682 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
9683 INFO: Writing RT_ICON 1 resource with 3752 bytes
9683 INFO: Writing RT_ICON 2 resource with 2216 bytes
9683 INFO: Writing RT_ICON 3 resource with 1384 bytes
9684 INFO: Writing RT_ICON 4 resource with 38188 bytes
9684 INFO: Writing RT_ICON 5 resource with 9640 bytes
9684 INFO: Writing RT_ICON 6 resource with 4264 bytes
9684 INFO: Writing RT_ICON 7 resource with 1128 bytes
9688 INFO: Appending archive to EXE C:\Users\chen\Downloads\niconvert-master\niconvert-master\build\main\main.exe
9691 INFO: Building EXE from EXE-00.toc completed successfully.
9695 INFO: checking COLLECT
9695 INFO: Building COLLECT because COLLECT-00.toc is non existent
9697 INFO: Building COLLECT COLLECT-00.toc
10804 INFO: Building COLLECT COLLECT-00.toc completed successfully.
muzuiget commented 3 years ago

不清楚,没用过 pyinstaller。不过我看你的信息,大概是文件名问题,你试试把 main.pyw 改名成 main.py 再打包。

RainySY commented 3 years ago

不清楚,没用过 pyinstaller。不过我看你的信息,大概是文件名问题,你试试把 main.pyw 改名成 main.py 再打包。

改成.py成功了,但貌似没有了GUI界面 我是想给一些新手用的,因为他们不会安装环境,以及没有相关的科学工具

RainySY commented 3 years ago

不清楚,没用过 pyinstaller。不过我看你的信息,大概是文件名问题,你试试把 main.pyw 改名成 main.py 再打包。

muzuiget commented 3 years ago

改一下 main.py 就行了,无非就是执行 niconvert.run_tk()

#!/usr/bin/env python3
import niconvert
niconvert.run_tk()