Slimerski
Slimerski

Reputation: 61

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

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?

Upvotes: 6

Views: 12054

Answers (4)

elinarezv
elinarezv

Reputation: 1

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

Upvotes: 0

Tega
Tega

Reputation: 11

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.

Upvotes: 1

iveor
iveor

Reputation: 19

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.

Upvotes: 0

Allison Barrezueta
Allison Barrezueta

Reputation: 11

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

Upvotes: 1

Related Questions