使用 conda activate ./envs 命令激活新环境时,VS code bash 开始显示这些 ASCII 字符

发布于 2025-01-15 09:18:18 字数 319 浏览 1 评论 0原文

以下命令用于在特定位置创建并激活环境。 但激活环境后,bash 终端的文本将更改为下图中突出显示的 ASCII 字符。

conda create --prefix ./envs
conda activate ./envs

查看突出显示的部分

The following commands were used to create and activate the environment in a specific location.
but after activating the environment the text of the bash terminal changes to ASCII characters highlighted in the below image.

conda create --prefix ./envs
conda activate ./envs

look at the highlighted section

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奶茶白久 2025-01-22 09:18:18

由于某些缓存问题,这是 VS Code 在创建虚拟环境时非常常见的问题。解决方案是:

  1. 关闭 VS Code 并打开 GitBash

  2. 然后输入以下 cmd:

    rm ~/.condarc

  3. 此命令将删除运行时配置文件。

    如果显示“未找到此类文件或目录”,则也没有问题。

  4. 现在输入以下命令:

    conda config --set env_prompt '({name})'

  5. 现在打开 VS Code 并激活环境。问题将会得到解决。

    此命令会将您的环境名称(整个文件路径)更改为基本名称(环境文件夹名称)

希望此解决方案有所帮助。如果您有任何疑问,请联系我。

This is a very common issue in VS Code while creating a virtual environment due to some cache issue. The solution for this is:

  1. Close VS Code and Open GitBash

  2. Then type in the following cmd:

    rm ~/.condarc

  3. This cmd will remove the runtime configuration file.

    If it says "No such file or directory found", then also no issues.

  4. Now type the following cmd:

    conda config --set env_prompt '({name})'

  5. Now open VS Code and activate the env. The Problem will be solved.

    This command will change your env name (which was the entire filepath) to just the base name (env folder name)

Hope this solution helps. If you have any queries just ping me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文