linux 打包python程序到exe

博客主要围绕Python报错‘OSError: Python library not found’展开,指出这是动态链接库问题,原因是LD_LIBRARY_PATH未设置。作者通过将python3.6环境链接,把so文件路径放入LD_LIBRARY_PATH解决问题,还提及PyInstaller在不同系统找库的情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错:

OSError: Python library not found: libpython3.6m.so.1.0, libpython3.6.so.1.0, libpython3.6mu.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.

 

http://blog.sina.com.cn/s/blog_6d24cc4e0102y4od.html
抱着吃水不忘挖井人的想法,https://pyinstaller.readthedocs.io/en/v3.3.1/when-things-go-wrong.html#build-time-python-errors

上面是官网报错,对于这个报错,其实是动态链接库的问题,在这里,我们要知道为什么动态链接库连接不上,是因为你的LD_LIBRARY_PATH 没有设置,将python3.6的环境链接一下,我这里直接将

export LD_LIBRARY_PATH=/home/comprehend/anaconda3/lib/python3.6/site-packages:$LD_LIBRARY_PATH放到环境变量中,再次之前我将位于/home/comprehend/anaconda3/lib里面的离别python3.6m.so.1.0 复制到了site-packages,现在测试一下是不是将/home/comprehend/anaconda3/lib防盗环境变量中,去掉上面的,发现做到了,就是这个so文件的问题,我们要把这个so文件的路径防盗LD_LIBARY_PATH 中

The places where PyInstaller looks for the python library are different in different operating systems, but /lib and /usr/lib are checked in most systems. If you cannot put the python library there, try setting the correct path in the environment variable LD_LIBRARY_PATH in Linux orDYLD_LIBRARY_PATH in OS X.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值