运行过程如下
C:\Users\wy>D:\xd.py
C:\Users\wy>pyinstaller D:\xd.py
81 INFO: PyInstaller: 3.5
81 INFO: Python: 3.8.8
88 INFO: Platform: Windows-10-10.0.19041-SP0
89 INFO: wrote C:\Users\wy\xd.spec
239 INFO: UPX is available.
240 INFO: Extending PYTHONPATH with paths
['D:\\', 'C:\\Users\\wy']
241 INFO: checking Analysis
242 INFO: Building Analysis because Analysis-00.toc is non existent
244 INFO: Initializing module dependency graph...
247 INFO: Initializing module graph hooks...
248 INFO: Analyzing base_library.zip ...
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Python runtime state: core initialized
Traceback (most recent call last):
File "d:\lib\io.py", line 52, in <module>
File "D:\abc.py", line 1, in <module>
RuntimeError: lost sys.stdout
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Python runtime state: core initialized
Traceback (most recent call last):
File "d:\lib\io.py", line 52, in <module>
File "D:\abc.py", line 1, in <module>
RuntimeError: lost sys.stdout
2647 INFO: Processing pre-find module path hook distutils
5654 INFO: running Analysis Analysis-00.toc
5668 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by d:\python.exe
7287 INFO: Caching module hooks...
7291 INFO: Analyzing D:\xd.py
8653 INFO: Processing pre-find module path hook site
8654 INFO: site: retargeting to fake-dir 'D:\\lib\\site-packages\\PyInstaller\\fake-modules'
19364 INFO: Processing pre-safe import module hook urllib3.packages.six.moves
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Python runtime state: core initialized
Traceback (most recent call last):
File "d:\lib\io.py", line 52, in <module>
File "D:\abc.py", line 1, in <module>
RuntimeError: lost sys.stdout
pre-safe-import-module hook failed, needs fixing.
好几个lost sys.stdout 最后那个needs fixing 错误搜了好久没找到解决方法