当前位置:   article > 正文

Pyinstaller py lib not found解决_pyinstaller.exceptions.pythonlibrarynotfounderror:

pyinstaller.exceptions.pythonlibrarynotfounderror: python library not found:

Pyinstaller: Python library not found

背景

MACOS Pyinstaller 打包生成文件时报错:

OSError: Python library not found: libpython3.7m.dylib, .Python, libpython3.7.dylib, Python
    This would mean your Python installation doesn't come with proper library files.
    This usually happens by missing development package, or unsuitable build parameters of Python installation.

    * On Debian/Ubuntu, you would need to install Python development packages
      * apt-get install python3-dev
      * apt-get install python-dev
    * If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

解决

我的python是用pyenv安装的,所以一般博客中重新编译Python对我来说不好使。在这里给出pyenv重新安装python并解决python lib not found问题。

  1. PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.10.5
  2. 需要重新安装库和包,否则import会报错,另外要先pip uninstall,再install,否则会告诉你requirements satisfied……
  3. 到安装的python3.10.5的bin目录下敲./pip uninstall pyinstaller./pip install pyinstaller
  4. 依法炮制安装其他依赖库
  5. 最后执行./pyinstaller -F -w test.py --onefile
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/723771
推荐阅读
相关标签
  

闽ICP备14008679号