我正在尝试使用arm64 Debian OS将简单的testFile.py转换为可执行文件。
$ cat testFile.py
import os
os.system('notepad')
转换为:
$ pyinstaller --onefile testFile.py
版本信息:
$ apt-cache policy python-pyinstaller
python-pyinstaller:
Installed: 3.1.1-0kali2
Candidate: 3.1.1-0kali2
Version table:
*** 3.1.1-0kali2 500
500 http://http.kali.org/kali kali-rolling/main arm64 Packages
100 /var/lib/dpkg/status
$ apt-cache policy python
python:
Installed: 2.7.15-3
Candidate: 2.7.15-3
Version table:
*** 2.7.15-3 500
500 http://http.kali.org/kali kali-rolling/main arm64 Packages
100 /var/lib/dpkg/status
$ apt-cache policy python-dev
python-dev:
Installed: 2.7.15-3
Candidate: 2.7.15-3
Version table:
*** 2.7.15-3 500
500 http://http.kali.org/kali kali-rolling/main arm64 Packages
100 /var/lib/dpkg/status
$ uname -a
Linux localhost 3.10.73-g5a2a297 #1 SMP PREEMPT Thu May 10 21:27:35 UTC 2018 aarch64 GNU/Linux
Pyinstaller错误:
$ pyinstaller --onefile testFile.py
1724 INFO: PyInstaller: 3.1.1+4529aa2
1726 INFO: Python: 2.7.15+
1735 INFO: Platform: Linux-3.10.73-g5a2a297-aarch64-with-Kali-kali-rolling-kali-rolling
1748 INFO: wrote /home/user/testFile.spec
1817 INFO: UPX is not available.
1844 INFO: Extending PYTHONPATH with paths
['/home/user', '/home/user']
1845 INFO: checking Analysis
1848 INFO: Building Analysis because out00-Analysis.toc is non existent
1849 INFO: Initializing module dependency graph...
2025 INFO: Initializing module graph hooks...
3256 INFO: running Analysis out00-Analysis.toc
3906 INFO: Analyzing /home/user/testFile.py
11389 INFO: Looking for import hooks ...
11412 INFO: Processing hook hook-encodings.py
19707 INFO: Looking for ctypes DLLs
19707 INFO: Analyzing run-time hooks ...
19725 INFO: Looking for dynamic libraries
25362 INFO: Looking for eggs
25364 INFO: Python library not in binary depedencies. Doing additional searching...
Traceback (most recent call last):
File "/usr/bin/pyinstaller", line 9, in <module>
load_entry_point('PyInstaller==3.1.1+4529aa2', 'console_scripts', 'pyinstaller')()
File "/usr/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 755, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 701, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/usr/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 212, in __init__
self.__postinit__()
File "/usr/lib/python2.7/dist-packages/PyInstaller/building/datastruct.py", line 183, in __postinit__
self.assemble()
File "/usr/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 510, in assemble
self._check_python_library(self.binaries)
File "/usr/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 578, in _check_python_library
python_lib = bindepend.get_python_library_path()
File "/usr/lib/python2.7/dist-packages/PyInstaller/depend/bindepend.py", line 852, in get_python_library_path
python_libname = findLibrary(name)
File "/usr/lib/python2.7/dist-packages/PyInstaller/depend/bindepend.py", line 798, in findLibrary
return os.path.join(dir, _get_so_name(lib))
File "/usr/lib/python2.7/dist-packages/PyInstaller/depend/bindepend.py", line 809, in _get_so_name
m = re.search(r'\s+SONAME\s+([^\s]+)', compat.exec_command(*cmd))
File "/usr/lib/python2.7/dist-packages/PyInstaller/compat.py", line 273, in exec_command
out = subprocess.Popen(cmdargs, stdout=subprocess.PIPE, **kwargs).communicate()[0]
File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
清除APT版本后,尝试使用pip安装pyinstaller,但显示“ pyinstaller的构建轮子失败”:
$ pip install pyinstaller
Collecting pyinstaller
Using cached https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef39a0cc/PyInstaller-3.4.tar.gz
Installing build dependencies ... done
Requirement already satisfied: setuptools in /usr/lib/python2.7/dist-packages (from pyinstaller) (40.6.2)
Requirement already satisfied: pefile>=2017.8.1 in /usr/local/lib/python2.7/dist-packages (from pyinstaller) (2018.8.8)
Requirement already satisfied: macholib>=1.8 in /usr/local/lib/python2.7/dist-packages (from pyinstaller) (1.11)
Requirement already satisfied: altgraph in /usr/local/lib/python2.7/dist-packages (from pyinstaller) (0.16.1)
Requirement already satisfied: dis3 in /usr/local/lib/python2.7/dist-packages (from pyinstaller) (0.1.2)
Requirement already satisfied: future in /usr/local/lib/python2.7/dist-packages (from pefile>=2017.8.1->pyinstaller) (0.17.1)
Building wheels for collected packages: pyinstaller
Running setup.py bdist_wheel for pyinstaller ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-BrOwFW/pyinstaller/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-RE4sQX --python-tag cp27:
running bdist_wheel
running build
running build_bootloader
No precompiled bootloader found. Trying to compile it for you ...
Setting top to : /tmp/pip-install-BrOwFW/pyinstaller/bootloader
Setting out to : /tmp/pip-install-BrOwFW/pyinstaller/bootloader/build
Python Version : 2.7.15+ (default, Nov 28 2018, 16:27:22) [GCC 8.2.0]
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Checking size of pointer : 8
Platform : Linux-64bit detected based on compiler
Checking for program '/usr/bin/strip' : /usr/bin/strip
Checking for program 'strip' : /usr/bin/strip
Checking for library dl : yes
Checking for library m : yes
Checking for library z : not found
The configuration failed
(complete log in /tmp/pip-install-BrOwFW/pyinstaller/bootloader/build/config.log)
ERROR: Failed compiling the bootloader. Please compile manually and rerun setup.py
----------------------------------------
Failed building wheel for pyinstaller
Running setup.py clean for pyinstaller
Failed to build pyinstaller
Installing collected packages: pyinstaller
Running setup.py install for pyinstaller ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-BrOwFW/pyinstaller/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-pv2WBP/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_bootloader
No precompiled bootloader found. Trying to compile it for you ...
Setting top to : /tmp/pip-install-BrOwFW/pyinstaller/bootloader
Setting out to : /tmp/pip-install-BrOwFW/pyinstaller/bootloader/build
Python Version : 2.7.15+ (default, Nov 28 2018, 16:27:22) [GCC 8.2.0]
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Checking size of pointer : 8
Platform : Linux-64bit detected based on compiler
Checking for program '/usr/bin/strip' : /usr/bin/strip
Checking for program 'strip' : /usr/bin/strip
Checking for library dl : yes
Checking for library m : yes
Checking for library z : not found
The configuration failed
(complete log in /tmp/pip-install-BrOwFW/pyinstaller/bootloader/build/config.log)
ERROR: Failed compiling the bootloader. Please compile manually and rerun setup.py
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-BrOwFW/pyinstaller/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-pv2WBP/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-BrOwFW/pyinstaller/