windows - 在 Windows 中临时删除环境 PATH 的一个变量
问题描述
我用 CMake 构建我的项目。
我想生成“MinGW Makefiles”,但 CMake 向我抛出了这个错误:
CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeMinGWFindMake.cmake:12 (message):
sh.exe was found in your PATH, here:
C:/Program Files/Git/usr/bin/sh.exe
For MinGW make to work correctly sh.exe must NOT be in your path.
Run cmake from a shell that does not have sh.exe in your PATH.
If you want to use a UNIX shell, then use MSYS Makefiles.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
似乎只有这个需要删除:
C:\Program Files\Git\cmd
在我的环境变量Path
中。
所以我想知道如何在 Windows CLI 中做到这一点。
解决方案
在运行之前尝试在命令行环境中运行它cmake
:
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
C:\Program Files\Git\usr\bin;
这将从您的PATH
字符串变量中删除特定路径 ( ),并PATH
使用字符串替换重新分配。
推荐阅读
- usd - Mac USD usdview 'python' 快死了
- python - 将 Python 浮点数传递给 C 函数时舍入模式不一致
- sql - LAST_VALUE with IF statement inside not backfill it's partition --> 在选择每个分区的第一行时丢失最后一个值(BigQuery/SQL)
- android-studio - 当我运行旧的颤振项目时,我遇到了错误,我该如何解决?
- amazon-web-services - 权限被拒绝(公钥)EC2
- reactjs - 如何为 Fluent UI 组件赋予样式?
- cobol - 编译从磁盘文件读取的 Cobol 程序时出现问题
- css - 如何将多个参数传递给 Sass Mixin:列表和命名变量
- python - 如何在openpyxl中删除图例名称
- sql - Group By 在 SQL Server 中从过去和将来的日期中获取当前匹配的有效数据