解决 pyinstaller 出现的不能打包的问题

发布时间 2023-05-31 15:56:39作者: Handsome、Snake

 

 

错误详情:
OSError: Python library not found: libpython3.7m.so, libpython3.7.so.1.0, libpython3.7m.so.1.0, libpython3.7.so, libpython3.7mu.so.1.0
This means your Python installation does not come with proper shared library files.
This usually happens due to missing development package, or unsuitable build parameters of the Python installation.

* On Debian/Ubuntu, you need to install Python development packages:
* apt-get install python3-dev
* apt-get install python-dev
* If you are building Python by yourself, rebuild with `--enable-shared` (or, `--enable-framework` on macOS).
解决方案:
- 重新编译 Python3
- 1. 进入Python 编译目录
   执行命令:
    ./configure --prefix=/usr/local/python3 --enable-shared --with-ssl
- 2. 进行编译
   make && make install

- 3.  查看动态库情况
   ldd /usr/local/python3/bin/python3
   查看 libpython3.7m.so.1.0 是否存在
- 4. 拷贝文件
   cp /usr/local/python3/lib/libpython3.7m.so.1.0 /usr/lib64/

 在没有进行第四步的时候, 执行 python3 都是提示 这行红色标记的 so 的没有找到

  在执行完第四步, 这里就显示有个 so 了

 

  在下载, pip3 install pyinstaller 

  测试, 打包单个文件