Python: libpython3.5.dylib not found?
Asked Answered
B

1

15

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?

Backbencher answered 15/2, 2017 at 9:39 Comment(6)
I'm working on figuring out a similar problem, but it would appear that Anaconda installs libpython3.6m.dylib (note the 'm'), which is just a build option when compiling Python. I tried just creating a symlink to overcome this but my project still failed to build so I'm guessing this is why. Not sure where to go next though.Austerity
@Austerity You are right. The 'm' matters, and now my project is working fine.Backbencher
Glad it worked for you, I gave up trying to build what I was building. Did you download another package or just symlink like I tried?Austerity
@Austerity No, I did not download any other package. I just created the executable using PyInstaller, py2app, or cxfreeze and then modified its Info.plist, changing libpython3.5.dylib to libpython3.5m.dylib.Backbencher
it's py2app that is failing to build when I get this error actually haha. It wasn't anything important luckily, just trying to build Spyder even though my current job mostly uses R.Austerity
Hi! I've run into the same problem as you and the same 'm' issue that @Austerity mentioned. Where exactly was this info.plist file that you modified? And what inside exactly did you modify?Wilma
G
11

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

Graduate answered 6/1, 2020 at 3:29 Comment(1)
This saved me, thanksEse

© 2022 - 2024 — McMap. All rights reserved.