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

运行mingw64.exe/clang64.exe时PATH环境变量设置异常咨询

MSYS2环境PATH异常问题

问题描述

Windows系统中安装MSYS2后,目录下包含mingw64.exe、clang64.exe等环境启动程序。根据MSYS2官方文档,启动对应程序应加载匹配的专属环境,但实际出现以下异常:

  • 运行mingw64.exe后执行echo $PATH,输出内容如下:
    /clang64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    
  • 运行clang64.exe后执行echo $PATH,输出内容如下:
    /clang64/bin:/clang64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    
  • 运行clangarm64.exe后执行echo $PATH,输出内容如下:
    /clang64/bin:/clangarm64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    

无论启动哪个环境程序,系统都会优先使用clang编译器,与预期不符。

补充测试结果

测试$MSYSTEM环境变量:

  • 启动mingw64.exe时,执行echo $MSYSTEM输出MINGW64
  • 启动clang64.exe时,执行echo $MSYSTEM输出CLANG64
    该变量值显示正常,符合对应环境的预期。

内容的提问来源于stack exchange,提问作者PavelDev

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 22:54:58