最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

VS Code Terminal Prepends Virtual Environment Name to Username in Zsh on macOS - Stack Overflow

programmeradmin2浏览0评论

When I create a virtual environment using Venv in Visual Studio Code--either using Cmd + Shift + P or via the command line--I notice the following prompt in the integrated Zsh terminal:

.venvusername@My-Computer-Name working-directory %

If I try to call source .venv/bin/activate, I'll see the following:

(.venv) .venvusername@My-Computer-Name working-directory %

If I deactivate twice and then activate, I'll notice an expected and familiar terminal prompt:

(.venv) vusername@My-Computer-Name working-directory %

This doesn't last, however, if I close out of VS Code and open my working directory again. I'll see the prompt I shared at the beginning. This also only seems to be an issue in VS Code. It doesn't happen if I activate my virtual environment in a Terminal outside of the VS Code. I'm wondering two things: (1) is this behavior normal and can I just disregard it, and (2) how do I ensure that the prompt with .venv in parentheses persists?

For context, I'm working on a Mac and have already tried analyzing .venv/bin/activate. It looks as expected on the line where PS1="(.venv) ${PS1:-}". Any help on this or insight is appreciated. I've also looked at the User Settings JSON and don't see anything unexpected there.

发布评论

评论列表(0)

  1. 暂无评论