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?

ashwin agrawal
  • 1,603
  • 8
  • 16
Slimerski
  • 61
  • 1
  • 1
  • 3
  • Try recreating the venv and possible reinstalling the base Python. – Pavel Karateev Jan 20 '20 at 11:15
  • I'm having a similar issue. In my case is: dyld[74260]: Library not loaded: /opt/homebrew/Cellar/python@3.8/3.8.13/Frameworks/Python.framework/Versions/3.8/Python I checked and the path "/opt/homebrew/Cellar/python@3.8/3.8.13/Frameworks/Python.framework/Versions/3.8/Python" does not exist, but "/opt/homebrew/Cellar/python@3.8/3.8.14/Frameworks/Python.framework/Versions/3.8/Python" does exist. Did you find a way to solve this situation? – Sergio García Oct 05 '22 at 11:59

3 Answers3

1

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

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.

ah bon
  • 9,293
  • 12
  • 65
  • 148
Tega
  • 11
  • 2
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.

iveor
  • 19
  • 2