menu Chancel's Blog
rss_feed lightbulb_outline

pyenv环境打包程序错误

类型:Python
创建时间:2021-08-14 00:29:15
更新时间:2021-08-14 00:29:15
类型:Python
更新时间:2021-08-14 00:29:15

在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

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

account_circle
email
web_asset
textsms

评论列表([[messageList.data.items.length]])

[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[messageItem.m_environ.browser]] [[messageItem.m_environ.os]] [[messageItem.m_environ.device]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[subMessage.m_environ.browser]] [[subMessage.m_environ.os]] [[subMessage.m_environ.device]]