ringsaturn
ringsaturn

Reputation: 99

Python quit unexpectedly on Mac

I have installed python3 from the here

When I try to run 'python3', it quits and give these information:

Fatal Python error: Py_Initialize: unable to load the file system codec ImportError: No module named 'encodings'

Current thread 0x00007fff960a93c0 (most recent call first): Abort trap: 6

Before that, I try to install python3 from Homebrew.

I don't remember whether I have to delete the build in python frameworks in the /Library/Frameworks/Python.framework

os : macOS

by the way, the IDLE works well

Upvotes: 5

Views: 6186

Answers (2)

Brandon Stewart
Brandon Stewart

Reputation: 743

brew reinstall openssl

Then:

cd /usr/local/lib
sudo ln -s /usr/local/opt/openssl/lib/libssl.dylib libssl.dylib
sudo ln -s /usr/local/opt/openssl/lib/libcrypto.dylib libcrypto.dylib

Upvotes: 1

Cory
Cory

Reputation: 785

If you are using Homebrew, you can reinstall a corrupted Python environment like this:

brew uninstall --ignore-dependencies --force python python@2
unset PYTHONPATH
brew install python python@2

I had a similar "quit unexpectedly" issue and this resolved it for me. pip and pip3 are both working fine after without messing with them.

Upvotes: 1

Related Questions