pyinstaller生成空的dist文件夹

时间:2020-01-08 17:37:25

标签: python python-3.x pyinstaller

我是python的新手,正在尝试创建Python应用程序的EXE。

我看到在Stack Overflow上有很多类似的问题,但是没有一个有意义的答案,所以我决定再次提出。

这是Pyinstaller的详细信息:

C:\Users\renan.klehm\Desktop\AutoCTE-Python>pyinstaller --onefile cli.py
164 INFO: PyInstaller: 3.5
165 INFO: Python: 3.8.0
165 INFO: Platform: Windows-7-6.1.7601-SP1
181 INFO: wrote C:\Users\renan.klehm\Desktop\AutoCTE-Python\cli.spec
184 INFO: UPX is not available.
185 INFO: Extending PYTHONPATH with paths
['C:\\Users\\renan.klehm\\Desktop\\AutoCTE-Python',
 'C:\\Users\\renan.klehm\\Desktop\\AutoCTE-Python']
185 INFO: checking Analysis
476 INFO: checking PYZ
476 INFO: Building PYZ because PYZ-00.toc is non existent
476 INFO: Building PYZ (ZlibArchive) C:\Users\renan.klehm\Desktop\AutoCTE-Python
\build\cli\PYZ-00.pyz
Traceback (most recent call last):
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\runpy
.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\runpy
.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\renan.klehm\AppData\Local\Programs\Python\Python38-32\Scripts\p
yinstaller.exe\__main__.py", line 7, in <module>
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\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:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\building\build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "C:\Users\renan.klehm\Desktop\AutoCTE-Python\cli.spec", line 18, in <modu
le>
    pyz = PYZ(a.pure, a.zipped_data,
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\building\api.py", line 98, in __init__
    self.__postinit__()
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\building\api.py", line 128, in assemble
    self.code_dict = {
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\building\api.py", line 129, in <dictcomp>
    key: strip_paths_in_code(code)
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code
    consts = tuple(
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-
packages\PyInstaller\building\utils.py", line 653, in <genexpr>
    strip_paths_in_code(const_co, new_filename)
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\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\renan.klehm\Desktop\AutoCTE-Python>pyinstaller cli.py
131 INFO: PyInstaller: 3.5
131 INFO: Python: 3.8.0
131 INFO: Platform: Windows-7-6.1.7601-SP1
143 INFO: wrote C:\Users\renan.klehm\Desktop\AutoCTE-Python\cli.spec
144 INFO: UPX is not available.
147 INFO: Extending PYTHONPATH with paths
['C:\\Users\\renan.klehm\\Desktop\\AutoCTE-Python',
 'C:\\Users\\renan.klehm\\Desktop\\AutoCTE-Python']
147 INFO: checking Analysis
424 INFO: checking PYZ
424 INFO: Building PYZ because PYZ-00.toc is non existent
426 INFO: Building PYZ (ZlibArchive) C:\Users\renan.klehm\Desktop\AutoCTE-Python\build\cli\PYZ-00.pyz

Traceback (most recent call last):
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\renan.klehm\AppData\Local\Programs\Python\Python38-32\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\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:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "C:\Users\renan.klehm\Desktop\AutoCTE-Python\cli.spec", line 18, in <module>
    pyz = PYZ(a.pure, a.zipped_data,
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 98, in __init__
    self.__postinit__()
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 128, in assemble
    self.code_dict = {
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 129, in <dictcomp>
    key: strip_paths_in_code(code)
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code
    consts = tuple(
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\utils.py", line 653, in <genexpr>
    strip_paths_in_code(const_co, new_filename)
  File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\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)

它会生成 build dist 文件夹,但会生成 dist 文件夹,其中.exe应该为空。

1 个答案:

答案 0 :(得分:1)

谢谢@John T

我降级到3.7.6,现在Pyinstaller正在按预期的方式构建.exe,当我运行.exe时会显示一些错误,但是它可以正常工作!

再次感谢。