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

如何在VS Code终端的PowerShell中将提示符改为(pyside2) PS <路径>>

修改PowerShell提示符为(pyside2) PS <path>>

临时生效(仅当前终端会话)

在VS Code的PowerShell终端中直接执行以下命令,回车后提示符立即变更,但关闭终端后会恢复默认:

function prompt {
    "(pyside2) PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
}

永久生效(所有PowerShell会话,包含VS Code终端)

  1. 检查PowerShell配置文件是否存在:
    Test-Path $PROFILE
    
    若返回False,执行以下命令创建配置文件:
    New-Item -Path $PROFILE -ItemType File -Force
    
  2. 打开配置文件进行编辑:
    notepad $PROFILE
    
  3. 在记事本中添加以下代码并保存:
    function prompt {
        "(pyside2) PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
    }
    
  4. 重启VS Code终端或PowerShell,新提示符即可永久生效。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.12 16:59:56