pyinstaller 构建错误或不 运行 脚本

pyinstaller build error or not run script

全部

我有一个python文件,现在我想用pyinstaller构建bin文件,但是pyinstall报这个错误

Traceback (most recent call last):
  File "/usr/local/bin/pyi-build", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python2.7/site-packages/PyInstaller/cliutils/build.py", line 37, in run
    PyInstaller.build.main(None, args[0], **opts.__dict__)
  File "/usr/local/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 "/usr/local/lib/python2.7/site-packages/PyInstaller/build.py", line 1873, in build
    execfile(spec)
  File "linux_server_script.spec", line 6, in <module>
    runtime_hooks=None)
  File "/usr/local/lib/python2.7/site-packages/PyInstaller/build.py", line 446, in __init__
    self.__postinit__()
  File "/usr/local/lib/python2.7/site-packages/PyInstaller/build.py", line 309, in __postinit__
    self.assemble()
  File "/usr/local/lib/python2.7/site-packages/PyInstaller/build.py", line 677, in assemble
    self._check_python_library(binaries)
  File "/usr/local/lib/python2.7/site-packages/PyInstaller/build.py", line 727, in _check_python_library
    raise IOError("Python library not found!")
IOError: Python library not found!

我的python first build没有使用--enable-shared,现在我重新编译python并添加选项“--enable-shared”,我复制libpython* .so* 到/usr/local/lib/,但问题也一样。

如果我导出 LD_LIBRARY_PATH=/usr/local/lib,可以构建成功,但是当我 运行 脚本

[pyinstall@zixun-01 tmp]$ ./linux_server_script 加载 Python lib '/tmp/libpython2.7.so.1.0' 时出错:/tmp/libpython2.7.so.1.0:无法打开共享对象文件:没有这样的文件或目录

这是 python 库错误

请删除 python 清理并重建 python 2.7 使用“./configure --enable-shared”

并使用 pyinstall 选项“-p /usr/local/lib”构建