9

I am using PyCharm 2018.3.2 Community Edition, under macOS Sierra V. 10.12.6

Today I found the following error message in Python-Console:

dyld: Library not loaded: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/Python
  Referenced from: /Users/tleis/PycharmProjects/BioInformaticsI/venv/bin/python
  Reason: image not found

After some research, I doubt the reason is due to some commands I run related to HomeBrew.

DanielM
  • 3,598
  • 5
  • 37
  • 53
mtleis
  • 712
  • 1
  • 9
  • 28

4 Answers4

8

The error message smells like you've probably updated your Python version, which can occasionally break virtualenvs with those symptoms.

The easiest fix is to just delete and recreate the virtualenv.

AKX
  • 152,115
  • 15
  • 115
  • 172
4

The same issue occured with me and I tried to change the project interpreter in the PyCharm IDE as shown below.

When there are multiple versions of Python present in your system, the IDE has to interpret the updated reference as it is in usr/local/bin/python {version}

enter image description here

Anupam
  • 131
  • 2
  • 6
2

I had the same issue, and as AKX says, deleting and recreating the virtualenv solved it. For those who, like me, weren't sure exactly how to do this, these commands did the trick for me:

$ find ~/.virtualenvs/env-name/ -type l -delete
$ virtualenv ~/.virtualenvs/env-name

Replace "env-name" with the name of the virtual environment in question. The path displayed in the error message should show you what the virtualenv name is.

ChiselD
  • 61
  • 1
  • 7
2

Just create a new virtual environment, by creating a new project. This is mostly because you ran a Python upgrade or did a unlink and re link of the python binaries. Also it helps if you can check at once without IDE , in the terminal if the program is working or not. Creating a new Virtual environment worked for me !!