通过使用pyinstaller分发用于Solaris OS的Python应用程序给我subproce

2019-10-21 09:00发布

据官方docsite,在Solaris下pyinstaller作品但到目前为止,我得到了stucked ..

我已经在x86下的Solaris 10u8系统内置开发虚拟环境,然后安装pyinstaller(与PIP)其他需要的模块间...

$> pip list
distribute (0.7.3)
...
pycrypto (2.6.1)
PyInstaller (2.1)
setuptools (3.6)
wsgiref (0.1.2)

试图从最基本的程序(test.py)做出ELF二进制文件:

#!/usr/bin/env python
print "hello world"

我得到了以下错误:

$> pyinstaller --onefile --clean test.py 
32 INFO: UPX is not available.
54 INFO: Processing hook hook-os
163 INFO: Processing hook hook-time
166 INFO: Processing hook hook-cPickle
238 INFO: Processing hook hook-_sre
356 INFO: Processing hook hook-cStringIO
453 INFO: Processing hook hook-encodings
469 INFO: Processing hook hook-codecs
...
2157 INFO: Analyzing test.py
2157 INFO: Hidden import 'codecs' has been found otherwise
2158 INFO: Hidden import 'encodings' has been found otherwise
2158 INFO: Looking for run-time hooks
Traceback (most recent call last):
File "/export/home/sistemas/virtualenvs/RadminPortal/bin/pyinstaller", line 9, in <module>
    load_entry_point('PyInstaller==2.1', 'console_scripts', 'pyinstaller')()
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/main.py", line 88, in run
    run_build(opts, spec_file, pyi_config)
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/main.py", line 46, in run_build
    PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/build.py", line 1924, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/build.py", line 1873, in build
    execfile(spec)
File "/export/home/sistemas/fmartin/pruebas/test.spec", line 6, in <module>
    runtime_hooks=None)
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/build.py", line 446, in __init__
    self.__postinit__()
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/build.py", line 309, in __postinit__
    self.assemble()
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/build.py", line 677, in assemble
    self._check_python_library(binaries)
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/build.py", line 713, in _check_python_library
    python_lib = bindepend.get_python_library_path()
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/bindepend.py", line 722, in get_python_library_path
    python_libname = findLibrary(name)
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/bindepend.py", line 657, in findLibrary
    return os.path.join(dir, getSoname(lib))
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/bindepend.py", line 665, in getSoname
    m = re.search(r'\s+SONAME\s+([^\s]+)', compat.exec_command(*cmd))
File "/export/home/sistemas/virtualenvs/RadminPortal/lib/python2.7/site-packages/PyInstaller/compat.py", line 210, in exec_command
    return subprocess.Popen(cmdargs, stdout=subprocess.PIPE).communicate()[0]
File "/opt/csw/lib/python2.7/subprocess.py", line 709, in __init__
    errread, errwrite)
File "/opt/csw/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

我需要别的什么,如果我已经安装了所有的Python库所需的软件包,并设置了方便的路径?

$> pkginfo | grep -i python
application CSWlibpython2-6-1-0              libpython2_6_1_0 - Python shared library (2.6)
application CSWlibpython2-7-1-0              libpython2_7_1_0 - A high-level scripting language., libpython2.7.so.1.0
application CSWpy-pip                        py_pip - A Python easy_install replacement
application CSWpy-setuptools                 py_setuptools - Distribution Utiltiies for Python
application CSWpython                        python - A high-level scripting language, 2.6 series
application CSWpython-dev                    python_dev - Development Files for Python
application CSWpython27                      python27 - A high-level scripting language, 2.7 series
application CSWpython27-dev                  python27_dev - Development Files for Python
...

$> echo $LD_LIBRARY_PATH
/opt/csw/lib/python2.7:/opt/csw/lib

$> echo $PATH
/usr/bin:/usr/local/bin:/opt/csw/gcc4/bin:/usr/sfw/bin:/opt/csw/bin

提前致谢!!

Answer 1:

由于是的Solaris下的实验港口类Pyinstaller可能无法通过使用PIP工作,它照常安装。 我会推荐给克隆了Pyinstaller GitHub的官方资料库。

请参阅: https://github.com/pyinstaller/pyinstaller

# /opt/csw/bin/git clone https://github.com/pyinstaller/pyinstaller.git

此外,PyInstaller引导程序必须是建立利用实验端口,以便确保您的LD_LIBRARY_PATH之前包含所有需要的路径和运行下面的命令:

# export PATH=${PATH}:/opt/csw/bin:/opt/csw/gcc4/bin:/usr/ccs/bin
# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/csw/lib/python2.7:/opt/csw/lib:/usr/local/lib
# python2.7 ./waf configure build install
SunOS-32bit detected
Checking for program gcc or cc           : /opt/csw/bin/gcc
Checking for program cpp                 : /opt/csw/bin/cpp
Checking for program ar                  : /usr/ccs/bin/ar
Checking for program ranlib              : /usr/ccs/bin/ranlib
Checking for gcc                         : ok 
Checking for library dl                  : yes
Checking for library z                   : yes
Checking for function readlink           : yes
Checking for flags -m32                  : yes
'configure' finished successfully (1.690s)
Waf: Entering directory `/export/home/sistemas/pyinstaller/bootloader/build'
[ 1/40] cc: linux/getpath.c -> build/debug/linux/getpath_1.o
[ 2/40] cc: common/pyi_global.c -> build/debug/common/pyi_global_1.o
[ 3/40] cc: common/pyi_launch.c -> build/debug/common/pyi_launch_1.o
...
'install' finished successfully (0.140s)

然后,非root用户,你就可以建立自己的蟒蛇。



文章来源: Distribute python application for Solaris OS by using pyinstaller gives me subprocess.py error