linux下运行pyinstaller故障解决

linux下运行pyinstaller故障解决

最近,需要在linux系统下

最近,需要在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

发表评论

电子邮件地址不会被公开。 必填项已用*标注