wenclick 发表于 2020-3-8 12:11

pyinstaller打包不成功,解决模块问题后又一次报错....

本帖最后由 wenclick 于 2020-3-8 19:24 编辑

(venv1) F:\excel信息填入word模版>pyinstaller -F main.py
804 INFO: PyInstaller: 3.6
805 INFO: Python: 3.6.5
806 INFO: Platform: Windows-7-6.1.7601-SP1
842 INFO: wrote F:\excel信息填入word模版\main.spec
857 INFO: UPX is not available.
865 INFO: Extending PYTHONPATH with paths
['F:\\excel信息填入word模版', 'F:\\excel信息填入word模版']
866 INFO: checking Analysis
868 INFO: Building Analysis because Analysis-00.toc is non existent
868 INFO: Initializing module dependency graph...
894 INFO: Caching module graph hooks...
922 INFO: Analyzing base_library.zip ...
8526 INFO: Caching module dependency graph...
8775 INFO: running Analysis Analysis-00.toc
8819 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by D:\Python36-32\python.exe
10294 INFO: Analyzing F:\excel信息填入word模版\main.py
12306 INFO: Processing module hooks...
12307 INFO: Loading module hook "hook-docx.py"...
12388 INFO: Loading module hook "hook-encodings.py"...
12899 INFO: Loading module hook "hook-lxml.etree.py"...
12902 INFO: Loading module hook "hook-pydoc.py"...
Traceback (most recent call last):
File "D:\Python36-32\Scripts\pyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.6', 'console_scripts', 'pyinstaller')()
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\building\build_main.py", line 729, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\building\build_main.py", line 676, in build
    exec(code, spec_namespace)
File "F:\excel信息填入word模版\main.spec", line 17, in <module>
    noarchive=False)
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\building\build_main.py", line 241, in __init__
    self.__postinit__()
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\building\build_main.py", line 418, in assemble
    self.graph.process_post_graph_hooks()
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\depend\analysis.py", line 297, in process_post_graph_hooks
    module_hook.post_graph()
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\depend\imphook.py", line 418, in post_graph
    self._load_hook_module()
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\depend\imphook.py", line 385, in _load_hook_module
    self.hook_module_name, self.hook_filename)
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\compat.py", line 608, in importlib_load_source
    return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\Python36-32\lib\site-packages\pyinstaller-3.6-py3.6.egg\PyInstaller\hooks\hook-pydoc.py", line 21, in <module>
    from PyInstaller.compat import is_py2, modname_tkinter
ImportError: cannot import name 'is_py2'
————————————————————————————————————————分割线————————————————————————————————————————————————

感谢各位已经解决了

打算用py2exe代替pyinstaller打包,也是不成功。又再安装了pyinstaller(没有删除原来的)。重新打包,成功了!!!!

小tg 发表于 2020-3-8 12:16

同求,我们都上了三次课了,我到现在都没安装好,和你的问题有点不一样,我直接一连串的错误,警告和未找到,难受的一批

windy_ll 发表于 2020-3-8 12:17

建议目录不要有中文名

RS水果 发表于 2020-3-8 12:23

引用了不兼容打包的模块
建议放弃打包
python本来就是用来部署的脚本
你要想打包为什么用python开发?
要么你换个语言打包比如C++C#javagolang

Nelson_saberbin 发表于 2020-3-8 12:26

python在Windows下打包就有点蛋疼了。我以前打包没有遇到什么大问题

河瞬 发表于 2020-3-8 12:27

加个-D参数试试看?你这里面可能有版本不兼容的模块,从ImportError: cannot import name 'is_py2'可以猜得可能某个模块需要Python2?

haoii123 发表于 2020-3-8 12:58

RS水果 发表于 2020-3-8 12:23
引用了不兼容打包的模块
建议放弃打包
python本来就是用来部署的脚本


是你的思想太封闭了,所以你永远不会用Python来开发

netCheney 发表于 2020-3-8 13:03

好多错误,看的头皮发麻,等大佬

RS水果 发表于 2020-3-8 13:55

haoii123 发表于 2020-3-8 12:58
是你的思想太封闭了,所以你永远不会用Python来开发

违规2次的号我也就不跟你计较了
再过段时间估计号就没了
呵呵

ymhld 发表于 2020-3-8 15:53

ImportError: cannot import name 'is_py2'

缺少这个库吧
页: [1] 2
查看完整版本: pyinstaller打包不成功,解决模块问题后又一次报错....