menu Chancel's blog
rss_feed
Chancel's blog
有善始者实繁,能克终者盖寡。

pyenv环境打包程序错误

作者:Chancel Yang, 创建:2021-08-14, 字数:921, 已阅:96, 最后更新:2024-03-10

在Manjaro下使用pyenv打包发布程序时出错,抛出了“Python library not found”的错误,大致如下

Bash
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解释器并重新安装,安装时附带生成共享库的参数,大致如下

Bash
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.9

参考来源:https://stackoverflow.com/questions/58548730/how-to-use-pyinstaller-with-pipenv-pyenv


[[replyMessage== null?"发表评论":"发表评论 @ " + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageResponse.total]])

还没有可以显示的留言...
[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[getEnviron(messageItem.m_environ)]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[getEnviron(messageItem.m_environ)]]