简体   繁体   English

Python 在 Mac 上意外退出

[英]Python quit unexpectedly on Mac

I have installed python3 from the here我已经从这里安装了 python3

When I try to run 'python3', it quits and give these information:当我尝试运行“python3”时,它退出并提供以下信息:

Fatal Python error: Py_Initialize: unable to load the file system codec ImportError: No module named 'encodings'致命的 Python 错误:Py_Initialize:无法加载文件系统编解码器 ImportError:没有名为“编码”的模块

Current thread 0x00007fff960a93c0 (most recent call first): Abort trap: 6当前线程 0x00007fff960a93c0(最近调用优先):中止陷阱:6

Before that, I try to install python3 from Homebrew.在此之前,我尝试从 Homebrew 安装 python3。

I don't remember whether I have to delete the build in python frameworks in the /Library/Frameworks/Python.framework我不记得我是否必须删除/Library/Frameworks/Python.framework中的 python 框架中的构建

os : macOS操作系统:macOS

by the way, the IDLE works well顺便说一下,IDLE 运行良好

If you are using Homebrew , you can reinstall a corrupted Python environment like this:如果您使用的是Homebrew ,则可以像这样重新安装损坏的 Python 环境:

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. pippip3在没有弄乱它们之后都可以正常工作。

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

I have installed python3 from the here我已经从这里安装了python3

When I try to run 'python3', it quits and give these information:当我尝试运行“ python3”时,它退出并给出以下信息:

Fatal Python error: Py_Initialize: unable to load the file system codec ImportError: No module named 'encodings'致命的Python错误:Py_Initialize:无法加载文件系统编解码器ImportError:没有名为“ encodings”的模块

Current thread 0x00007fff960a93c0 (most recent call first): Abort trap: 6当前线程0x00007fff960a93c0(最近一次调用优先):中止陷阱:6

Before that, I try to install python3 from Homebrew.在此之前,我尝试从Homebrew安装python3。

I don't remember whether I have to delete the build in python frameworks in the /Library/Frameworks/Python.framework我不记得是否必须删除/Library/Frameworks/Python.framework中python框架中的构建

os : macOS操作系统:macOS

by the way, the IDLE works well顺便说一句,IDLE运行良好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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