当前位置:  开发笔记 > 编程语言 > 正文

PyInstaller和Python3.6 - 元组索引

如何解决《PyInstaller和Python3.6-元组索引》经验,为你挑选了0个好方法。

我写了一个Python程序,大多数将要运行它的人都是Windows用户.我尝试在2个不同的设备上使用pyinstaller和py2exe,一个使用Windows,另一个使用arch-linux.

我使用pip3安装pyinstaller --no-cache不止一次重新安装它

我总是得到同样的错误:

    sudo pyinstaller --windowed --onefile test.py
49 INFO: PyInstaller: 3.2
49 INFO: Python: 3.6.0
50 INFO: Platform: Linux-4.8.13-1-ARCH-x86_64-with-arch
51 INFO: wrote /home/XXXXX/test.spec
52 INFO: UPX is not available.
53 INFO: Extending PYTHONPATH with paths
['/home/XXXXX', '/home/XXXXX']
54 INFO: checking Analysis
54 INFO: Building Analysis because out00-Analysis.toc is non existent
54 INFO: Initializing module dependency graph...
57 INFO: Initializing module graph hooks...
58 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
  File "/usr/bin/pyinstaller", line 11, in 
    load_entry_point('PyInstaller==3.2', 'console_scripts', 'pyinstaller')()
  File "/usr/lib/python3.6/site-packages/PyInstaller/__main__.py", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/usr/lib/python3.6/site-packages/PyInstaller/__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/usr/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 788, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/usr/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 734, in build
    exec(text, spec_namespace)
  File "", line 16, in 
  File "/usr/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 212, in __init__
    self.__postinit__()
  File "/usr/lib/python3.6/site-packages/PyInstaller/building/datastruct.py", line 178, in __postinit__
    self.assemble()
  File "/usr/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 317, in assemble
    excludes=self.excludes, user_hook_dirs=self.hookspath)
  File "/usr/lib/python3.6/site-packages/PyInstaller/depend/analysis.py", line 560, in initialize_modgraph
    graph.import_hook(m)
  File "/usr/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 906, in import_hook
    q, tail = self._find_head_package(parent, name, level)
  File "/usr/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 990, in _find_head_package
    q = self._safe_import_module(head, qname, parent)
  File "/usr/lib/python3.6/site-packages/PyInstaller/depend/analysis.py", line 209, in _safe_import_module
    module_basename, module_name, parent_package)
  File "/usr/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1211, in _safe_import_module
    module_name, file_handle, pathname, metadata)
  File "/usr/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1295, in _load_module
    self._scan_code(m, co, co_ast)
  File "/usr/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1460, in _scan_code
    self._scan_bytecode_stores(co, m)
  File "/usr/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1505, in _scan_bytecode_stores
    name = co.co_names[oparg]
IndexError: tuple index out of range

那么,在这种情况下,我只使用了包含以下内容的测试脚本:

#!/usr/bin/env  python3.6
print("hello world")

确保进口没有问题,等等.

推荐阅读
可爱的天使keven_464
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有