作者:E4b9a6, 创建:2021-08-14, 字数:922, 已阅:124, 最后更新:2024-03-10
在Manjaro下使用pyenv打包发布程序时出错,抛出了“Python library not found”的错误,大致如下
OSError: Python library not found: libpython3.6mu.so.1.0, libpython3.6m.so, libpython3.6m.so.1.0, libpython3.6.so.1.0
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)
原因是Pyenv在编译安装Python版本时默认不生成共享库(shared-library),所以会抛出这个错误
解决方法是卸载当前环境的Python解释器并重新安装,安装时附带生成共享库的参数,大致如下
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.9
参考来源:https://stackoverflow.com/questions/58548730/how-to-use-pyinstaller-with-pipenv-pyenv