Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSError: Python library not found: libpython3.9mu.so.1.0, libpython3.9m.so, etc., when running pyinstaller

I am trying to create an executable from a python script, using pyinstaller, and am getting the error seen in the subject line. The particulars:

  • python - version 3.9.2
  • pyinstaller - version 4
  • I am running on Debian Linux

I evoke pyinstaller as:

pyinstaller --onefile pythonfile.py

When I looked to see what libpython*.so files were resident, I see libpython3.7*.so, and the error shows I need to install libpython3.9*so files.

I have tried:

 pip3 install PyInstaller (to load on pyinstaller)
 apt-get install python3-dev (as recommended in the pyinstaller error msg)
 apt-get install python-dev (as recommended in the pyinstaller error msg)
 apt-get upgrade
 apt-get update

but still get the error. How can I get the correct libpython*.so files loaded (i.e., 3.9)? TIA.

like image 313
user3063547 Avatar asked Sep 08 '25 03:09

user3063547


1 Answers

You need to generate the shared lib using:

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.2

I'm not sure whether 3.9.2 is working if not try 3.9.0

Official Document Here.

like image 185
Zichzheng Avatar answered Sep 09 '25 17:09

Zichzheng