Ubuntu miniconda3 환경에서 명령줄을 조정하는 방법은 무엇입니까?

Ubuntu miniconda3 환경에서 명령줄을 조정하는 방법은 무엇입니까?

Ubuntu(WSL2)에서 miniconda3 환경을 활성화할 때도 명령줄이 변경됩니다. 활성화하기 전에 내 명령줄은 파일에 변수를 정의한 것처럼 보입니다 PS1..bashrc

username@workingdirectory$

활성화 후 명령줄은 다음과 같습니다.

(base)username@pc:/path/working/directory$

색상 변경이 포함됩니다.

명령줄이 원본(색상 포함)과 유사하게 보이도록 하고 싶습니다. 명령줄 끝에 현재 conda 환경의 이름을 추가하기만 하면 됩니다. 예를 들어: username@workingdirectory (base)$

changeps1에서 설정했지만 false명령 .condarc줄에서 conda 환경만 제거하고 나머지 명령줄(색상 포함)은 계속 변경합니다.

내가 원하는 대로 conda 환경에서 명령줄을 조정하는 방법을 아는 사람이 있습니까?

@Edgar Magallan의 답변을 따르도록 편집되었습니다 $HOME/miniconda3/bin/activate.

#!/bin/sh
_CONDA_ROOT="/home/username/miniconda3"
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
\. "$_CONDA_ROOT/etc/profile.d/conda.sh" || return $?
conda activate "$@"

conda.sh편집 2: 내 파일에는 PS1이 언급된 두 곳이 있습니다 .

__conda_activate() {
if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
    # Handle transition from shell activated with conda <= 4.3 to a subsequent activation
    # after conda updated to >= 4.4. See issue #6173.
    PS1="$CONDA_PS1_BACKUP"
    \unset CONDA_PS1_BACKUP
fi
\local ask_conda
ask_conda="$(PS1="${PS1:-}" __conda_exe shell.posix "$@")" || \return
\eval "$ask_conda"
__conda_hashr
}

그리고:

if [ -z "${CONDA_SHLVL+x}" ]; then
   \export CONDA_SHLVL=0
   # In dev-mode CONDA_EXE is python.exe and on Windows
   # it is in a different relative location to condabin.
   if [ -n "${_CE_CONDA:+x}" ] && [ -n "${WINDIR+x}" ]; then
       PATH="$(\dirname "$CONDA_EXE")/condabin${PATH:+":${PATH}"}"
   else
       PATH="$(\dirname "$(\dirname "$CONDA_EXE")")/condabin${PATH:+":${PATH}"}"
   fi
   \export PATH

   # We're not allowing PS1 to be unbound. It must at least be set.
   # However, we're not exporting it, which can cause problems when starting a second shell
   # via a first shell (i.e. starting zsh from bash).
   if [ -z "${PS1+x}" ]; then
       PS1=
   fi
fi

관련 정보