Python 在Windows 10 Cmd中使用Pyinstaller时出现未知错误

Python 在Windows 10 Cmd中使用Pyinstaller时出现未知错误,python,exe,pyinstaller,Python,Exe,Pyinstaller,我正在尝试为工作创建一个python可执行文件,但Windows 10 Cmd出现了一个问题。我不确定问题是什么,更不用说如何解决了。我已经在下面粘贴了cmd窗口 我试图制作一个可执行文件的程序,只是从excel文档中获取一些数据,获取相关信息并编写一个文本文件。当我在Python中运行代码时,代码运行良好,但可执行文件给我带来了麻烦 我应该只能够使用命令“pyinstaller FileName.py”(不带引号),但是我得到了这些错误 C:\Users\Lord Karl\Desktop\X

我正在尝试为工作创建一个python可执行文件,但Windows 10 Cmd出现了一个问题。我不确定问题是什么,更不用说如何解决了。我已经在下面粘贴了cmd窗口

我试图制作一个可执行文件的程序,只是从excel文档中获取一些数据,获取相关信息并编写一个文本文件。当我在Python中运行代码时,代码运行良好,但可执行文件给我带来了麻烦

我应该只能够使用命令“pyinstaller FileName.py”(不带引号),但是我得到了这些错误

C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit>pyinstaller --onefile Ex1PyCode.py
104 INFO: PyInstaller: 3.5
105 INFO: Python: 3.8.0
107 INFO: Platform: Windows-10-10.0.17763-SP0
110 INFO: wrote C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\Ex1PyCode.spec
117 INFO: UPX is not available.
117 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Lord Karl\\Desktop\\XLS2CAT_Notes\\Example1_Fruit',
 'C:\\Users\\Lord Karl\\Desktop\\XLS2CAT_Notes\\Example1_Fruit']
133 INFO: checking Analysis
133 INFO: Building Analysis because Analysis-00.toc is non existent
133 INFO: Initializing module dependency graph...
153 INFO: Initializing module graph hooks...
157 INFO: Analyzing base_library.zip ...
8546 INFO: running Analysis Analysis-00.toc
8552 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\python\python.exe
11709 INFO: Caching module hooks...
11720 INFO: Analyzing C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\Ex1PyCode.py
11770 INFO: Processing pre-find module path hook   distutils
13445 INFO: Processing pre-find module path hook   site
13445 INFO: site: retargeting to fake-dir 'c:\\python\\lib\\site-packages\\PyInstaller\\fake-modules'
15396 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
22186 INFO: Processing pre-safe import module hook   six.moves
27347 INFO: Loading module hooks...
27347 INFO: Loading module hook "hook-distutils.py"...
27355 INFO: Loading module hook "hook-encodings.py"...
27497 INFO: Loading module hook "hook-lib2to3.py"...
27497 INFO: Loading module hook "hook-numpy.core.py"...
27744 INFO: Loading module hook "hook-numpy.py"...
27744 INFO: Loading module hook "hook-pandas.py"...
29447 INFO: Loading module hook "hook-pkg_resources.py"...
30197 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
30260 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
30356 INFO: Loading module hook "hook-pydoc.py"...
30356 INFO: Loading module hook "hook-pytz.py"...
30465 INFO: Loading module hook "hook-setuptools.py"...
31231 INFO: Loading module hook "hook-sqlite3.py"...
31358 INFO: Loading module hook "hook-sysconfig.py"...
31358 INFO: Loading module hook "hook-xml.dom.domreg.py"...
31374 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
31374 INFO: Loading module hook "hook-xml.py"...
31467 INFO: Looking for ctypes DLLs
31545 INFO: Analyzing run-time hooks ...
31577 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
31577 INFO: Including run-time hook 'pyi_rth_pkgres.py'
31624 INFO: Looking for dynamic libraries
67758 INFO: Looking for eggs
67759 INFO: Using Python library c:\python\python38.dll
67759 INFO: Found binding redirects:
[]
67799 INFO: Warnings written to C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\build\Ex1PyCode\warn-Ex1PyCode.txt
68189 INFO: Graph cross-reference written to C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\build\Ex1PyCode\xref-Ex1PyCode.html
68361 INFO: checking PYZ
68376 INFO: Building PYZ because PYZ-00.toc is non existent
68376 INFO: Building PYZ (ZlibArchive) C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\build\Ex1PyCode\PYZ-00.pyz
Traceback (most recent call last):
  File "c:\python\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
  File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\Ex1PyCode.spec", line 18, in <module>
    pyz = PYZ(a.pure, a.zipped_data,
  File "c:\python\lib\site-packages\PyInstaller\building\api.py", line 98, in __init__
    self.__postinit__()
  File "c:\python\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\python\lib\site-packages\PyInstaller\building\api.py", line 128, in assemble
    self.code_dict = {
  File "c:\python\lib\site-packages\PyInstaller\building\api.py", line 129, in <dictcomp>
    key: strip_paths_in_code(code)
  File "c:\python\lib\site-packages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code
    consts = tuple(
  File "c:\python\lib\site-packages\PyInstaller\building\utils.py", line 653, in <genexpr>
    strip_paths_in_code(const_co, new_filename)
  File "c:\python\lib\site-packages\PyInstaller\building\utils.py", line 660, in strip_paths_in_code
    return code_func(co.co_argcount, co.co_kwonlyargcount, co.co_nlocals, co.co_stacksize,
TypeError: an integer is required (got type bytes)
C:\Users\Lord Karl\Desktop\XLS2CAT\u Notes\Example1\u Fruit>pyinstaller--onefile Ex1PyCode.py
104信息:PyInstaller:3.5
105信息:Python:3.8.0
107信息:平台:Windows-10-10.0.17763-SP0
110信息:写C:\Users\Lord Karl\Desktop\XLS2CAT\U Notes\Example1\u Fruit\Ex1PyCode.spec
117信息:UPX不可用。
117信息:使用路径扩展PYTHONPATH
['C:\\Users\\Lord Karl\\Desktop\\XLS2CAT\u Notes\\Example1\u Fruit',
'C:\\Users\\Lord Karl\\Desktop\\XLS2CAT\u Notes\\Example1\u Fruit']
133信息:检查分析
133信息:建筑分析,因为Analysis-00.toc不存在
133信息:正在初始化模块依赖关系图。。。
153信息:正在初始化模块图挂钩。。。
157信息:正在分析base_library.zip。。。
8546信息:运行分析-00.toc
8552信息:将Microsoft.Windows.Common-Controls添加到最终可执行文件的相关程序集
c:\python\python.exe所需
11709信息:缓存模块挂钩。。。
11720信息:分析C:\Users\Lord Karl\Desktop\XLS2CAT\U Notes\Example1\u Fruit\Ex1PyCode.py
11770信息:处理预查找模块路径挂钩区
13445信息:正在处理预查找模块路径挂钩站点
13445信息:站点:重新定位到伪目录'c:\\python\\lib\\site packages\\PyInstaller\\fake modules'
15396信息:处理预安全导入模块hook setuptools.extern.six.moves
22186信息:正在处理预安全导入模块hook six.moves
27347信息:加载模块挂钩。。。
27347信息:加载模块挂钩“hook distutils.py”。。。
27355信息:加载模块钩子“hook encodings.py”。。。
27497信息:加载模块挂钩“hook-lib2to3.py”。。。
27497信息:加载模块挂钩“hook numpy.core.py”。。。
27744信息:加载模块挂钩“hook numpy.py”。。。
27744信息:加载模块挂钩“hook pandas.py”。。。
29447信息:加载模块hook“hook-pkg_resources.py”。。。
30197信息:正在处理预安全导入模块挂钩win32com
回溯(最近一次呼叫最后一次):
文件“”,第2行,在
ModuleNotFoundError:没有名为“win32com”的模块
30260信息:正在处理预安全导入模块挂钩win32com
回溯(最近一次呼叫最后一次):
文件“”,第2行,在
ModuleNotFoundError:没有名为“win32com”的模块
30356信息:加载模块钩子“hook pydoc.py”。。。
30356信息:加载模块挂钩“hook pytz.py”。。。
30465信息:加载模块钩子“hook setuptools.py”。。。
31231信息:加载模块hook“hook-sqlite3.py”。。。
31358信息:正在加载模块挂钩“hook sysconfig.py”。。。
31358信息:正在加载模块钩子“hook xml.dom.domreg.py”。。。
31374信息:加载模块钩子“hook xml.etree.cElementTree.py”。。。
31374信息:正在加载模块钩子“hook xml.py”。。。
31467信息:正在查找ctypes DLL
31545信息:正在分析运行时挂钩。。。
31577信息:包括运行时钩子'pyi\u rth\u multiprocessing.py'
31577信息:包括运行时钩子'pyi_rth_pkgres.py'
31624信息:寻找动态库
67758信息:寻找鸡蛋
67759信息:使用Python库c:\Python\python38.dll
67759信息:找到绑定重定向:
[]
67799信息:向C:\Users\Lord Karl\Desktop\XLS2CAT\u Notes\Example1\u Fruit\build\Ex1PyCode\warn-Ex1PyCode.txt写入的警告
68189信息:写入C:\Users\Lord Karl\Desktop\XLS2CAT\u Notes\Example1\u Fruit\build\Ex1PyCode\xref-Ex1PyCode.html的图形交叉引用
68361信息:正在检查PYZ
68376信息:正在生成PYZ,因为PYZ-00.toc不存在
68376信息:构建PYZ(ZlibArchive)C:\Users\Lord Karl\Desktop\XLS2CAT\u Notes\Example1\u Fruit\build\Ex1PyCode\PYZ-00.PYZ
回溯(最近一次呼叫最后一次):
文件“c:\python\lib\runpy.py”,第192行,位于作为主模块的运行模块中
返回运行代码(代码、主全局、无、,
文件“c:\python\lib\runpy.py”,第85行,在运行代码中
exec(代码、运行\全局)
文件“C:\Python\Scripts\pyinstaller.exe\\uuuuu main\uuuuuu.py”,第9行,在
文件“c:\python\lib\site packages\PyInstaller\\uuuuu main\uuuuuu.py”,第111行,正在运行
运行构建(pyi\u配置,规范文件,**vars(args))
文件“c:\python\lib\site packages\PyInstaller\\uuuuu main\uuuuuu.py”,第63行,在run\u build中
PyInstaller.building.build\u main.main(pyi\u配置,spec\u文件,**kwargs)
文件“c:\python\lib\site packages\PyInstaller\building\build\u main.py”,第844行,在main中
构建(specfile,kw.get('distpath'),kw.get('workpath'),kw.get('clean_build'))
文件“c:\python\lib\site packages\PyInstaller\building\building\u main.py”,第791行,内部版本
exec(代码、规范和命名空间)
文件“C:\Users\Lord Karl\Desktop\XLS2CAT\u Notes\Example1\u Fruit\Ex1PyCode.spec”,第18行,在
pyz=pyz(a.pure,a.zipped_数据,
文件“c:\python\lib\site packages\PyInstaller\building\api.py”,第98行,在\uuu init中__
self.\uuuu postinit\uuuuu()
文件“c:\python\lib\site packages\PyInstaller\building\datastruct.py”,第158行,在\uu postinit中__
self.assembly()
汇编中的文件“c:\python\lib\site packages\PyInstaller\building\api.py”,第128行
self.code_dict={
文件“c:\python\lib\site packages\PyInstaller\building\api.py”,第129行,在
关键字:代码中的条带路径(代码)
文件“c:\python\lib\site packages\PyInstaller\building\utils.py”,第652行,位于代码中的strip\u路径中
常量=元组(
文件“c:\python\lib\site packages\PyInstaller\building\utils.py”,第653行,在
代码中的条带路径(常量,新文件名)
文件“c:\python\lib\site packages\PyInstaller\building\utils.py”,第660行,位于代码中的strip\u路径中
返回代码_func(co.co_argcount、co.co_kwonlyargcount、co.co_nlocals、co.co_stacksize、,
TypeError:需要一个整数(得到t