Pyinstaller: Cannot open shared object libpython3.5m.so.1.0
Asked Answered
G

2

8

I am trying to create an executable for my Python application using PyInstaller. There are no errors when creating the executable, but when I subsequently try to run it, the following error occurs: [6439] Error loading Python lib '~/PycharmProjects/CetPar/ceteris_paribus/control/build/controller/libpython3.5m.so.1.0': dlopen: ~/PycharmProjects/CetPar/ceteris_paribus/control/build/controller/libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

I have already tried exporting multiple versions of the LD_LIBRARY_PATH variable, but this does not seem to have any effect. Trying to find the shared object by running the locate libpython3.5m.so.1.0 command results in /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0, but adding /usr/lib/ to the LD_LIBRARY_PATH path does not work. I suspect this has something to do with the installation location of my python interpreters, but I have been unable to find anything. Furthermore, I noticed that PyInstaller also creates a /dist/ directory, and the shared object file can be found here.

I am running elementary OS 0.4.1 Loki

Does anyone have any suggestions about things I can still try?

Gaudette answered 20/3, 2018 at 18:14 Comment(0)
G
10

There should be two folders dist and build in project folder after running pyinstaller. Copy dist/controller content into build/controller directory:

cp -r ./dist/controller/* build/controller
Gocart answered 1/8, 2018 at 8:46 Comment(2)
Man that works, but could you share some knowledge why? Or a link to a decent read on that topic (pytinstaller's docs are okay'ish at best imho)Mortgagee
@Mortgagee sorry I don't remember any details and I have no any links to share...Gocart
S
1

When using pyinstaller make sure to use the flag -F to make it a standalone executable

pyinstaller -F main.py

Then, after the build is complete, you'll find your standalone executable inside the dist directory(not the build directory)

Somerset answered 18/2 at 6:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.