dyld: Library not loaded: /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Python
Asked Answered
M

4

6

When trying to run simple python3 code via pycharm, I get following error

/Users/slimerski/PycharmProjects/studia/venv/bin/python /Users/slimerski/PycharmProjects/studia/zadania_14.py dyld: Library not loaded: /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Python Referenced from: /Users/slimerski/PycharmProjects/studia/venv/bin/python Reason: image not found

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

Everything was working until recently I have installed zsh and updated xcode via brew. I have tried fixing it with otool -L exefile but instead I get another error

/Library/Developer/CommandLineTools/usr/bin/objdump: error: 'exefile': No such file or directory.

Is there anyway to fix it?

Mensal answered 18/1, 2020 at 12:17 Comment(2)
Try recreating the venv and possible reinstalling the base Python.Gilding
I'm having a similar issue. In my case is: dyld[74260]: Library not loaded: /opt/homebrew/Cellar/[email protected]/3.8.13/Frameworks/Python.framework/Versions/3.8/Python I checked and the path "/opt/homebrew/Cellar/[email protected]/3.8.13/Frameworks/Python.framework/Versions/3.8/Python" does not exist, but "/opt/homebrew/Cellar/[email protected]/3.8.14/Frameworks/Python.framework/Versions/3.8/Python" does exist. Did you find a way to solve this situation?Decane
T
1

Maybe you uninstall that version of python, in this case 3.7... You have to download it again and execute

Telling answered 22/1, 2020 at 12:52 Comment(1)
Or they have updated to a more recent point release of Python 3.7Sethsethi
P
1

I think your environmental variable path may be the problem. If you recently upgraded to MacOS catalina you need to do this:

1, use this command to check what your current variables are set to.

$ env

mine looks like this: (lookout for the word PATH, as there will be a long list of environmental variable details)

PATH=/Users/.../dev/venv/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin

2, what you want to do next is write your path into a ./zshrc file.

$ vi ~/.zshrc

Paste the PATH you copied earlier into this location. It will be different for everyone.

it should look like this:

export PATH="/Users/.../dev/venv/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:$PATH"

3, save your file and exit vi. I assume everyone knows but if you don't: Press the ESC key then type in:-

:wq!

this will save the file and exit vi

4, activate your file

$ . ~/.zshrc

your python programs should run without a problem now.

Pasteurization answered 19/4, 2020 at 23:28 Comment(0)
K
0

Anytime a shared image is deleted, whether via a brew update or otherwise, your virtualenvs will all break because the python version theyre symlinked to can not longer find a library it was compiled with. (OP obviously knows this.)

If you recompile the installed binary, you shouldn't need to touch the virtualenvs.

Assuming your installed version is 3.7.4, and you're maintaining installs using pyenv:

pyenv uninstall 3.7.4
pyenv install 3.7.4

Note that dev versions of python aren't guaranteed to stay compatible, so you might have a trickier time with those.

Krasnoyarsk answered 20/4, 2020 at 2:1 Comment(0)
P
0

Solved using another forum response:

curl -sSL https://install.python-poetry.org | python3 - --uninstall
curl -sSL https://install.python-poetry.org | python3 -

Thanks to: tekumara

https://github.com/orgs/python-poetry/discussions/8298#discussioncomment-6697516

Philps answered 8/10, 2024 at 19:0 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.