2017-04-21 8 views
0

Pyinstallerを使用して私の.pyスクリプトから実行ファイルをビルドしようとしています。問題は、Python 3.5の代わりにPython 2.7を使用してビルドしているため、実行ファイルが実行されなくなることです。2.7の代わりにPython 3.5を使用するようにPyinstallerに指示する方法は?

[email protected] ~/Desktop $ pyinstaller --onefile Vocabulary.py 
25 INFO: PyInstaller: 3.2.1 
25 INFO: Python: 2.7.12 
26 INFO: Platform: Linux-4.4.0-72-generic-x86_64-with-LinuxMint-18.1-serena 
26 INFO: wrote /home/cali/Desktop/Vocabulary.spec 
31 INFO: UPX is not available. 
32 INFO: Extending PYTHONPATH with paths 
['/home/cali/Desktop', '/home/cali/Desktop'] 
32 INFO: checking Analysis 
33 INFO: Building Analysis because out00-Analysis.toc is non existent 
33 INFO: Initializing module dependency graph... 
34 INFO: Initializing module graph hooks... 
139 INFO: running Analysis out00-Analysis.toc 
160 INFO: Caching module hooks... 
164 INFO: Analyzing /home/cali/Desktop/Vocabulary.py 
246 INFO: Processing pre-safe import module hook _xmlplus 
1991 INFO: Processing pre-find module path hook distutils 
2209 INFO: Loading module hooks... 
2209 INFO: Loading module hook "hook-distutils.py"... 
2210 INFO: Loading module hook "hook-xml.py"... 
2959 INFO: Loading module hook "hook-httplib.py"... 
2960 INFO: Loading module hook "hook-encodings.py"... 
3427 INFO: Looking for ctypes DLLs 
3428 INFO: Analyzing run-time hooks ... 
3435 INFO: Looking for dynamic libraries 
3663 INFO: Looking for eggs 
3663 INFO: Python library not in binary depedencies. Doing additional searching... 
3707 INFO: Using Python library /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 
3710 INFO: Warnings written to /home/cali/Desktop/build/Vocabulary/warnVocabulary.txt 
3768 INFO: checking PYZ 
3768 INFO: Building PYZ because out00-PYZ.toc is non existent 
3768 INFO: Building PYZ (ZlibArchive) /home/cali/Desktop/build/Vocabulary/out00-PYZ.pyz 
4122 INFO: Building PYZ (ZlibArchive) /home/cali/Desktop/build/Vocabulary/out00-PYZ.pyz completed successfully. 
4172 INFO: checking PKG 
4172 INFO: Building PKG because out00-PKG.toc is non existent 
4172 INFO: Building PKG (CArchive) out00-PKG.pkg 
7322 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully. 
7336 INFO: Bootloader /usr/local/lib/python2.7/dist-packages/PyInstaller/bootloader/Linux-64bit/run 
7336 INFO: checking EXE 
7336 INFO: Building EXE because out00-EXE.toc is non existent 
7336 INFO: Building EXE from out00-EXE.toc 
7337 INFO: Appending archive to ELF section in EXE /home/cali/Desktop/dist/Vocabulary 
7352 INFO: Building EXE from out00-EXE.toc completed successfully. 

どうすれば問題を解決できますか?

@EDIT:

クラウディオが示唆したように、私はpip3 install pyinstallerを使用してpyInstallerのをインストールしようとしたが、私は取得しています:

[email protected] ~/Desktop $ pip3 install pyinstaller 
Collecting pyinstaller 
    Using cached PyInstaller-3.2.1.tar.bz2 
Collecting setuptools (from pyinstaller) 
    Using cached setuptools-35.0.1-py2.py3-none-any.whl 
Collecting appdirs>=1.4.0 (from setuptools->pyinstaller) 
    Using cached appdirs-1.4.3-py2.py3-none-any.whl 
Collecting packaging>=16.8 (from setuptools->pyinstaller) 
    Using cached packaging-16.8-py2.py3-none-any.whl 
Collecting six>=1.6.0 (from setuptools->pyinstaller) 
    Using cached six-1.10.0-py2.py3-none-any.whl 
Collecting pyparsing (from packaging>=16.8->setuptools->pyinstaller) 
    Using cached pyparsing-2.2.0-py2.py3-none-any.whl 
Building wheels for collected packages: pyinstaller 
    Running setup.py bdist_wheel for pyinstaller ... error 
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-42qpk7iy/pyinstaller/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpmmn5007ppip-wheel- --python-tag cp35: 
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] 
    or: -c --help [cmd1 cmd2 ...] 
    or: -c --help-commands 
    or: -c cmd --help 

    error: invalid command 'bdist_wheel' 

    ---------------------------------------- 
    Failed building wheel for pyinstaller 
    Running setup.py clean for pyinstaller 
Failed to build pyinstaller 
Installing collected packages: appdirs, six, pyparsing, packaging, setuptools, pyinstaller 
    Running setup.py install for pyinstaller ... done 
Successfully installed appdirs-1.4.3 packaging-16.8 pyinstaller-3.2.1 pyparsing-2.2.0 setuptools-35.0.1 six-1.10.0 
You are using pip version 8.1.1, however version 9.0.1 is available. 
You should consider upgrading via the 'pip install --upgrade pip' command. 
+0

可能な重複[PythonのバージョンpyInstallerのは、使用を指定する方法?](http://stackoverflow.com/questions/42525896/how-to-specify-python-version-pyinstaller-uses) – spectras

答えて

0

あなたが使用してpyInstallerのインストール直面する問題を解決するには、次の

pip3 pyinstallerをインストール

次に正しいものを実行するよう注意してください(Python2.7モジュールのパスとPython3.5モジュールのパスの2つが異なる場所にあります)

PyInstaller for私のマシン上のPython 3.5:

$ pip3 install pyinstaller 
Collecting pyinstaller 
Collecting setuptools (from pyinstaller) 
    Using cached setuptools-35.0.1-py2.py3-none-any.whl 
Collecting six>=1.6.0 (from setuptools->pyinstaller) 
    Using cached six-1.10.0-py2.py3-none-any.whl 
Collecting appdirs>=1.4.0 (from setuptools->pyinstaller) 
    Using cached appdirs-1.4.3-py2.py3-none-any.whl 
Collecting packaging>=16.8 (from setuptools->pyinstaller) 
    Using cached packaging-16.8-py2.py3-none-any.whl 
Collecting pyparsing (from packaging>=16.8->setuptools->pyinstaller) 
    Using cached pyparsing-2.2.0-py2.py3-none-any.whl 
Installing collected packages: six, appdirs, pyparsing, packaging, setuptools, pyinstaller 
Successfully installed appdirs-1.4.3 packaging-16.8 pyinstaller-3.2.1 pyparsing-2.0.3 setuptools-20.7.0 six-1.10.0 

それは、うーん...問題なくインストールされます...

試してみてください。

sudo -H pip3 install setuptools --upgrade 

(の詳細を参照- あなたはこの問題に一人ではありません)私はこれが答えではない知っているが、私はコメントするのに十分な評判を持っていけない

+0

私の編集した質問を見る –

0

申し訳ありません:

は、このリンクをチェックしてください:

https://anaconda.org/acellera/pyinstaller

私が使用しましたあなたのために正しいpyinstallerを見つけるのに約10分かかりますが、これは私が見つけることができる最高のものです。申し訳ありませんが私は助けをしなかった場合

*私はあなたにアナコンダを使用することをお勧めします。

0

pyinstallerにpython 3.5のパスを指定する-upx-dirオプションを設定するだけです。それは仮想環境でもあります。例えば:

pyinstaller --upx-dir="$HOME/virtual-envs/<your-virtual-env>/lib/python3.5/site-packages/" <your-script>.py' 
関連する問題