首页 > 解决方案 > Pyinstaller 在 macos 上抛出错误

问题描述

我必须用一些 c++ 库来冻结 python 应用程序。我在 python 中制作了简单的文件(只是打印消息),我尝试使用pyinstaller main.py

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/pyinstaller", line 10, in <module>
    sys.exit(run())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 791, in build
    exec(code, spec_namespace)
  File ".../main.spec", line 29, in <module>
    console=False )
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/building/api.py", line 435, in __init__
    upx_exclude=self.upx_exclude
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/building/api.py", line 197, in __init__
    self.__postinit__()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
    self.assemble()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/building/api.py", line 284, in assemble
    pylib_name=pylib_name)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/archive/writers.py", line 334, in __init__
    super(CArchiveWriter, self).__init__(archive_path, logical_toc)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/archive/writers.py", line 61, in __init__
    self._add_from_table_of_contents(logical_toc)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/archive/writers.py", line 86, in _add_from_table_of_contents
    self.add(toc_entry)  # The guts of the archive.
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/archive/writers.py", line 375, in add
    code = get_code_object(nm, pathnm)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/building/utils.py", line 625, in get_code_object
    raise ValueError("Module file %s is missing" % filename)
ValueError: Module file .../main.py is missing

我不知道该怎么办。谷歌什么都没有。我尝试重新安装 pyinstaller。

标签: python-3.xpyinstaller

解决方案


推荐阅读