
아주 가끔 conda를 설치를 했지만 PATH 등에 conda의 실행파일들의 경로가 안 잡혀서
conda activate 등이 전혀 동작하지 않는 경우가 있음.
주로 shell 을 바꾼 경우나 설치 중 초기화 부분에 문제가 있을 때 발생하는 문제로
conda init <현재_shell> 을 통해 .bashrc 나 .zshrc 등의 설정을 수정하면된다.
다음의 명령어들을 Anaconda Prompt에서 수행하면 됨.
bash 기준
$ conda init bash
$ source .bashrc # 수행.
zsh 기준
$ conda init zsh
$ source .zshrc
cmd 기준
$ conda init cmd.exe
- 이후 cmd.exe를 재시작함.
Windows PowerShell 기준
$ conda init powershell
- 이후 powershell을 재시작함.
- 만약 ps1등의 프로파일 파일을 보안 설정으로 실행못한다는 메시지가 보일 경우엔 동작하지 않으므로
- 관리자 모드로 PowerShell을 시작(PowerShell 아이콘에 우클릭하면 관리자 모드 실행이 보임)하여
- 다음을 실행:
set-executionpolicy remotesigned
확인하기
각 shell의 설정파일에 다음의 블럭이 마지막에 추가되었다면 이후 제대로 수행될 것임.
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
...
관련 설정 처리
...
# <<< conda initialize <<<
관련하여 읽어보면 좋은 자료들
2025.12.31 - [shell] - PowerShell의 초기화-profile
PowerShell의 초기화-profile
PowerShell의 profile이란?PowerShell의 profile은셸이 시작될 때 자동으로 실행되어환경 변수, alias, 함수, 초기화 코드 등을 설정하는시작 스크립트(확장자 .ps1 파일).PowerShell은 상황에 따라 서로 다른 prof
ds31x.tistory.com
2023.06.29 - [개발환경] - [CLI] Power Shell의 Profile 수정 : conda를 위해서
[Errors] Power Shell의 Profile 이 동작안할 경우-conda init이 안 먹힘
Power Shell의 profile 경로에 한글이 있는 경우, conda등의 activate가 제대로 안되는 경우가 있다. 이 경우가 발생하는 대부분의 이유는, 사용자 이름 등을 한글로 한 경우나...onedrive를 한글 윈도우에서
ds31x.tistory.com
powershell conda 설정하기
안녕하세요. 다들 python 사용할 때 conda 많이 사용하시나요? 패키지 관리(pip)가 편해서 주로 사용하고 ...
blog.naver.com
https://dsaint31.tistory.com/238
sh파일(non-interactive shell script)에서 conda 가상환경 activation!
ubuntu에서 셀스크립트를 작성하던 중, conda activate 가 동작하지 않던 문제가 발생.non-interactive shell script 의 경우 ~/.bashrc 를 로드하지 않아서 이를 통한 초기화가 수행되지 않음.cron 등을 이용한 경
dsaint31.tistory.com
'개발환경' 카테고리의 다른 글
| [vscode] external terminal 사용하기 (0) | 2023.12.15 |
|---|---|
| [CE] shortcuts (or hot-keys, 단축키) : Basic (1) | 2023.12.15 |
| [zsh] zsh-autosuggestions (1) | 2023.09.08 |
| [zsh] zsh-syntax-highlighting 설치. (0) | 2023.09.08 |
| [zsh] .profile의 설정을 .zprofile로 ... (2) | 2023.09.08 |