超算Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

文章讲述了在使用Anaconda的Python时遇到的编码问题,特别是`init_fs_encoding`失败,解决方法是设置正确的PYTHONHOME和PYTHONPATH,并提到_C_++Boost调用时也遇到类似错误。
摘要由CSDN通过智能技术生成
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/lustre/home/xzhou/anaconda3/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/lustre/home/xzhou/anaconda3/bin/python'
  sys.base_prefix = '/lustre/home/xzhou/anaconda3'
  sys.base_exec_prefix = '/lustre/home/xzhou/anaconda3'
  sys.executable = '/lustre/home/xzhou/anaconda3/bin/python'
  sys.prefix = '/lustre/home/xzhou/anaconda3'
  sys.exec_prefix = '/lustre/home/xzhou/anaconda3'
  sys.path = [
    '/lustre/home/xzhou/anaconda3/lib/python38.zip',
    '/lustre/home/xzhou/anaconda3/lib/python3.8',
    '/lustre/home/xzhou/anaconda3/lib/python3.8/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: no codec search functions registered: can't find encoding

Current thread 0x00002ab215870ec0 (most recent call first):
<no Python frame>
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/lustre/home/xzhou/anaconda3/bin/python'
  sys.base_prefix = '/lustre/home/xzhou/anaconda3'
  sys.base_exec_prefix = '/lustre/home/xzhou/anaconda3'
  sys.executable = '/lustre/home/xzhou/anaconda3/bin/python'
  sys.prefix = '/lustre/home/xzhou/anaconda3'
  sys.exec_prefix = '/lustre/home/xzhou/anaconda3'
  sys.path = [
    '/lustre/home/xzhou/anaconda3/lib/python38.zip',
    '/lustre/home/xzhou/anaconda3/lib/python3.8',
    '/lustre/home/xzhou/anaconda3/lib/python3.8/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: no codec search functions registered: can't find encoding

Current thread 0x00002aed882fcec0 (most recent call first):
<no Python frame>

  1. Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

出现这种原因,我的是因为用了Anaconda的python!!!
在cmd中输入python也会提示同样的问题!
把PYTHONHOME 和 PYTHONPATH改成conda的目录即可!

  1. Fatal Python error: initfsencoding: Unable to get the locale encoding(好像不是同一个问题)
  2. C++ Boost调用python报错:init_fs_encoding:failed to get the Python codec of the file
    在这里插入图片描述
  3. 错误:Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding(经验证管用!!!!!!)
    在这里插入图片描述
  4. 已解决Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  5. linux查看python环境变量_Linux中添加PYTHONPATH配置anaconda环境变量方法
    在这里插入图片描述
  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值