Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: libpython3.5.dylib not found?

I would like to make a Mac executable for my Python code but always got this error message:

OSError: Python library not found: .Python, libpython3.5.dylib, Python

Both PyInstaller and py2app returned the same error. What should I do to overcome this problem?

like image 522
mawgumelar Avatar asked Feb 15 '17 09:02

mawgumelar


1 Answers

For Mac, try rebuild python to generated shared lib using:

env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.5.x

as said in pyenv offical doc

in which 3.5.x is version of python which you are using

For my here, after reinstall python:

env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.8.0

the dylib located in

~/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/lib/libpython3.8.dylib

which is soft link to 3.4MB file:

~/.pyenv/versions/3.8.0/Python.framework/Versions/3.8/Python

like image 163
crifan Avatar answered Oct 06 '22 20:10

crifan