PyInstaller编译linux,linux下运行pyinstaller故障解决

最近,需要在linux系统下,使用pyinstaller生成py文件的可执行文件,但遇到一些报错,最后总算解决。

首先运行pyinstaller –onefile test.py,显示报错信息

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

搜了搜,需要安装python-devel,运行yum install python-devel,结果显示找不到这个包。后来又搜了搜,是使用./configure –enable-shared重新编译python,编译后,make,make install安装好后,运行python3,又报错

python3: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

这时,

cd /etc/ld.so.conf.d

vi python3.conf

输入/usr/local/lib,然后:wq保存退出

运行ldconfig

之后在运行python3就没问题了

python3

Python 3.7.4 (default, Sep 6 2019, 09:10:20)

[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux

Type “help”, “copyright”, “credits” or “license” for more information.

运行pyinstaller也好了pyinstaller –onefile test.py

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值