python - 运行pyinstaller时OSError : Python library not found: libpython3. 9mu.so.1.0, libpython3.9m.so等

标签 python pyinstaller

我正在尝试使用 pyinstaller 从 python 脚本创建一个可执行文件,并且在主题行中看到了错误。具体情况:

  • python - 版本 3.9.2
  • pyinstaller - 版本 4
  • 我在 Debian Linux 上运行

我将 pyinstaller 称为:

pyinstaller --onefile pythonfile.py

当我查看驻留的 libpython*.so 文件时,我看到 libpython3.7*.so,错误显示我需要安装 libpython3.9*so 文件。

我试过了:

 pip3 install PyInstaller (to load on pyinstaller)
 apt-get install python3-dev (as recommended in the pyinstaller error msg)
 apt-get install python-dev (as recommended in the pyinstaller error msg)
 apt-get upgrade
 apt-get update

但仍然得到错误。我怎样才能加载正确的 libpython*.so 文件(即 3.9)? TIA。

最佳答案

您需要使用以下方式生成共享库:

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.2

如果不尝试 3.9.0,我不确定 3.9.2 是否有效

官方文档Here .

关于python - 运行pyinstaller时OSError : Python library not found: libpython3. 9mu.so.1.0, libpython3.9m.so等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68462920/

相关文章:

python-3.x - 使用 Pyinstaller 制作 .exe 后 Pygame 未加载 png

python - Pyinstaller 不使用 sklearn 编译导入的模块

python - 即使我能够安装其他库,安装 pyinstaller 时也会出现 SSL 错误

python - 创建神经网络

c# - Python .NET、多线程和 Windows 事件循环

python - 使用 Django 创建一个 jSON 数组

tensorflow - Windows 10 pyinstaller tensorflow 缺少模块

python - 接受有和没有值(value)的选项

python - 如何将数据框中的所有对象类型值转换为 int

python - 在 PyInstaller 应用程序中启用 Windows 长文件路径支持