You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Anaconda无法启动及Python环境报错问题求助

问题描述

电脑中存在两个Python版本:Anaconda自带的Python 3.9,以及微软商店下载的Python 3.10。计划卸载微软商店版本,但操作前出现以下问题:

  • Anaconda Navigator无法启动
  • 在CMD(包括Anaconda专属CMD)中执行"C:\Users\faris\anaconda3\python.exe"时,出现致命错误:
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'C:\Users\faris\anaconda3\python.exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = 'C:\\Users\\faris\\anaconda3\\python.exe'
  sys.base_prefix = 'C:\\Users\\faris\\anaconda3'
  sys.base_exec_prefix = 'C:\\Users\\faris\\anaconda3'
  sys.platlibdir = 'lib'
  sys.executable = 'C:\\Users\\faris\\anaconda3\\python.exe'
  sys.prefix = 'C:\\Users\\faris\\anaconda3'
  sys.exec_prefix = 'C:\\Users\\faris\\anaconda3'
  sys.path = [
    'C:\\Users\\faris\\anaconda3\\python39.zip',
    '.\\DLLs',
    '.\\lib',
    'C:\\Users\\faris\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00004530 (most recent call first):
<no Python frame>
  • 将Anaconda路径加入系统/用户Path后,python命令可替代完整路径,但报错依旧
  • 直接双击C:\Users\faris\anaconda3\python.exe可运行,但提示环境未激活;执行conda activate时同样触发上述致命错误
解决方案

1. 清除微软商店Python的路径污染

  • 打开「环境变量」设置:右键「此电脑」→「属性」→「高级系统设置」→「环境变量」
  • 在用户变量和系统变量的Path列表中,找到C:\Users\faris\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0并删除
  • 将Anaconda的核心路径移至Path最顶端,确保优先级最高:
    • C:\Users\faris\anaconda3
    • C:\Users\faris\anaconda3\Scripts
    • C:\Users\faris\anaconda3\Library\bin

2. 配置Anaconda专属环境变量

  • 新增系统变量CONDA_HOME,值设为C:\Users\faris\anaconda3
  • 确认上述三个Anaconda路径已正确加入Path

3. 修复Anaconda的Shell初始化

  • 关闭所有CMD窗口,重新打开Anaconda Prompt(若能正常打开),执行:
    conda init cmd.exe
    
  • 若Anaconda Prompt也无法打开,手动激活环境:
    1. 打开普通CMD,执行:
      C:\Users\faris\anaconda3\Scripts\activate.bat
      
    2. 接着执行:
      conda activate base
      

4. 验证修复效果

  • 重启CMD,执行python --version,确认显示Anaconda的Python 3.9版本
  • 执行conda --version,确认conda命令正常输出版本号
  • 尝试启动Anaconda Navigator,检查是否能正常运行

5. 卸载微软商店版Python

  • 打开「设置」→「应用」→「应用和功能」,找到Python 3.10 (来自Microsoft Store),点击卸载;或直接在微软商店中搜索对应版本并卸载

内容的提问来源于stack exchange,提问作者The Man Who Sold The World

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 22:12:53