学无先后,达者为师

网站首页 编程语言 正文

Fatal Python error: Py_Initialize: unable to load the file system codec

作者:NoOne-csdn 更新时间: 2022-04-01 编程语言
打开terminal报错
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

分析原因:
想清理python的安装版本,删掉一些文件后就出现如此了,手贱……

解决:

1. sudo vim /etc/profile/
2. export PYTHONHOME=/Library/Frameworks/Python.framework/Versions/3.7
export PYTHONPATH=.:$PYTHONHOME/bin:$PYTHONHOME/site-packages
export PATH=$PATH:$PYTHONHOME:$PYTHONP

运行之后报错

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

继续修改
删掉关于anaconda有关的环境变量

perfect!

原文链接:https://blog.csdn.net/weixin_40161254/article/details/88576220

栏目分类
最近更新