CS/삽질로그
[anaconda] conda activate 동작하지 않을 때 (conda init 관련 오류)
judy@
2023. 4. 7. 00:57
문제 상황
conda 설치 후 init을 수행하였으나 이후 가상 환경 활성화 등이 동작하지 않는 상황.
$ conda activate base
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
위와 같은 오류 메세지를 보고 conda init을 수행하였지만, no changes 메세지만 뜰 뿐 위와 같은 오류는 계속됨
문제 해결
위 문제는 conda init <SHELL_NAME> 을 통해 shell(ex. bash)의 설정 부분이 변경되었는데, 변경 내용이 현재 활성화된 shell에 반영되지 않아 발생한 문제로 파악됨. 따라서 다음과 같은 source 명령어로 shell의 설정을 적용해보았으며, 이를 통해 위 문제가 해결됨.
# 문제 해결 명령어
$ source .bashrc
(base) $ conda activate test
(test) $
source를 통해 반영하고 나니, 쉘에 conda 가상 환경이 정상적으로 적용되어 다음줄부터 현재 적용된 가상환경의 상태가 나타났으며, 위와 같이 활성화 명령어가 잘 동작하는 것을 확인함.
반응형