26

vincens@VMAC: python3 dyld: Library not loaded:/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation

Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python Reason: image not found [1] 25278 abort python3

python3 env is not used when I update my Mac to the latest version. How can I solve it?

liangli
  • 1,151
  • 9
  • 11
Vincens Chan
  • 261
  • 1
  • 3
  • 3

6 Answers6

30

This worked for me with the same issue.

Check if you have multiple Python3.x versions installed. In my case I had Python3.6 and Python3.9 installed. brew uninstall python3 did not remove Python3.6 completely.

I was able to call Python3.9 from Terminal by explicitly running python3.9 instead of python3, which led me to believe the issue was caused by ambiguity in which Python3.x resource was to be used.

Manually deleted /Library/Frameworks/Python.framework/Versions/3.6 resulted in Python3 running as expected.

hint: It may be sufficient to remove /Library/Frameworks/Python.framework/Versions/3.6 from your PATH environment variable.

Richard Barber
  • 5,257
  • 2
  • 15
  • 26
stephanoz
  • 381
  • 3
  • 4
12

Check in the location:

/usr/bin/python3

If you can invoke python3 interpreter from this location without any issues, copy this to

/usr/local/bin/python3

I upgraded to macOS Big Sur and had faced the same issue. I was not able to open Python interpreter from terminal and the Python version inside Library/Frameworks/Python.framework/Versions/3.6 was also being pointed to Python2.7.

Later, I found python3 in location /usr/bin/python3 working fine for me. I also tried creating a symlink for python3 to the above path but didn't work.

Manu mathew
  • 859
  • 8
  • 25
11

That's becuase you have installed both python 3.6 from system library & python3.9 from other source like brew and there are something wrong with the python in lower version. Please manually delete the python within /Library/Frameworks. sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.6 this command works for me.

wbwb
  • 121
  • 1
  • 6
0

I encountered this same problem on Step 1 of PyCharm's Create a Django project documentation.

I had previously set up Python on my Mac following these instructions. Can't promise this solution will work for everyone, but maybe if someone's Python was set up similar to mine the following solution that worked for me might help you...

  1. Open Terminal
  2. which python3
  3. Copy the directory given to you... (For me it was /Users/foo/.pyenv/bar/python3)
  4. When creating your new Django project in PyCharm (Professional Edition), set your base directory to the one received from which python3
  5. Create your project
Dharman
  • 30,962
  • 25
  • 85
  • 135
JHowzer
  • 3,684
  • 4
  • 30
  • 36
0

I had python 3.9 on Mac. I needed to switch to python3.6.

I first install python 3.6.0 (download python-3.6.0-macosx10.6.pkg, then double click and follow installation steps). Then, I had the same error as in your question.

Then I installed python 3.6.5(download python-3.6.5-macosx10.9.pkg, then double click and follow installation steps) and it worked.

Roxana
  • 1
-1

My case

  1. Deleted Xcode (Maybe some folders are accidentally deleted like /Library/Frameworks/...
  2. Also installed Python with anaconda.

My solution

  1. Reinstall Xcode
  2. Followed this to remove anaconda then everything works fine
Pak Ho Cheung
  • 1,382
  • 6
  • 22
  • 52