简体   繁体   中英

Resolving PyCharm python error - dyld: Library not loaded

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.

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.

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.

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}

在此处输入图片说明

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 !!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM