我正在尝试使用 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/