sys.exit(run()) File "/usr/local/python374/..._pyinstaller.exceptions.pythonlibrarynotfounderror: python library not">
当前位置:   article > 正文

pyinstaller 出现 OSError: Python library not found_pyinstaller.exceptions.pythonlibrarynotfounderror:

pyinstaller.exceptions.pythonlibrarynotfounderror: python library not found:

想使用pyinstaller隐藏代码部署时 ,遇到报错 

具体报错如下:
 

  1. Traceback (most recent call last):
  2. File "/usr/local/python374/bin/pyinstaller", line 10, in <module>
  3. sys.exit(run())
  4. File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/__main__.py", line 111, in run
  5. run_build(pyi_config, spec_file, **vars(args))
  6. File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/__main__.py", line 63, in run_build
  7. PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  8. File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 844, in main
  9. build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  10. File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 791, in build
  11. exec(code, spec_namespace)
  12. File "/run/projects/simulate_area/bi_for_/console_.spec", line 17, in <module>
  13. noarchive=False)
  14. File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 243, in __init__
  15. self.__postinit__()
  16. File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
  17. self.assemble()
  18. File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 575, in assemble
  19. self._check_python_library(self.binaries)
  20. File "/usr/local/python374/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 681, in _check_python_library
  21. raise IOError(msg)
  22. OSError: Python library not found: libpython3.7m.so.1.0, libpython3.7.so.1.0, libpython3.7m.so, libpython3.7mu.so.1.0
  23. This would mean your Python installation doesn't come with proper library files.
  24. This usually happens by missing development package, or unsuitable build parameters of Python installation.
  25. * On Debian/Ubuntu, you would need to install Python development packages
  26. * apt-get install python3-dev
  27. * apt-get install python-dev
  28. * If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)

于是先安装 python3-devel,

yum install python3-devel

完成后仍然报错,我是自己编译的python,于是尝试重新编译:

  1. rm -rf Python-3.7.4
  2. tar -xzf Python-3.7.4.tgz
  3. cd Python-3.7.4
  4. ./configure --prefix=/usr/local/python374 --enable-optimizations --with-openssl=/usr/local/openssl --enable-shared
  5. make && make install

开启--enable-shared后会报 找不到so的错误 解决如下:

  1. echo "/usr/local/python374/lib/" >> /etc/ld.so.conf
  2. ldconfig

之后再使用pyinstaller console_.py ok

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/723762
推荐阅读
相关标签
  

闽ICP备14008679号