2017-01-10 22 views
5

私は少しPythonプログラムを書いており、それを実行しようとしている人のほとんどはWindowsユーザーです。 pyinstallerとpy2exeを2つの異なるデバイス、つまりWindowsとarch-linuxで使用しようとしました。PyInstallerとPython3.6 - Tuple Index

私はいつも同じエラーを取得PIP3は--no-キャッシュ

pyInstallerのをインストールし使用して、複数回、それを再インストール:だから、

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 <module> 
    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 "<string>", line 16, in <module> 
    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 

その場合には、私はちょうどにTestScriptを使用輸入品等に問題がないことを確認するために、

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

を含む。

+1

「Python 3.6はまだサポートされていません。 https://github.com/pyinstaller/pyinstaller/issues/2286 – davedwards

+0

まあ、高速回答ありがとう。残念ながら、Windowsマシンでは、pyinstaller.exeをcmdに入力するとプロセスが作成されません。私はこれを解決しようとします、ここに解決策があるようです:https://stackoverflow.com/questions/31808180/installing-pyinstaller-via-pip-leads-to-failed-to-create-process – Simulacrum

答えて

2

python 3.6とpyinstallerで同じ問題が発生し、初めて使用したのはcx_Freezeです。それは魅力のように働いた!

Setup.py内容:setup.pyがあるディレクトリに

import cx_Freeze 
exe = [cx_Freeze.Executable("downloads_folder.py")] 
cx_Freeze.setup(name = "downloads", 
       version = "1.0", 
       options = {"build_exe": {"packages": ["errno", "os", "re", "stat", "subprocess","collections","pprint","shutil", "humanize","pycallgraph"], "include_files": []}}, 
       executables = exe) 

スタートCMD、次のコマンドを実行します。Pythonはを構築するのsetup.py。

実行ファイルは、cx_Freeze runで作成されたビルドディレクトリにあります。

0

ここと同じですが、私も新しく、あなたと同じ問題を抱えています。私は約6時間立ち往生し、すべてを試しました。最後に私はcx_freezeもインストールして動作しました。

pip install cx_freeze

3

PyinstallerはまだPython 3,6をサポートしていません。 Python 3.5に戻すこともできますが、cx_Freezeソリューションを試してみることもできます。何が起きているのかはっきりしません。私はそれを置き換えると思います。

関連する問題