카테고리 없음

[autoenv] 특정 폴더 진입시 자동으로 특정 아나콘다 환경 활성화하기

Hithero 2025. 9. 20. 19:06

특정 폴더에 진입할 때, 자동으로 실행하고자 하는 코드가 존재한다면

 

GitHub - hyperupcall/autoenv: Directory-based environments.

Directory-based environments. Contribute to hyperupcall/autoenv development by creating an account on GitHub.

github.com

해당 프로그램을 활용하면 된다. 아래는 설치코드 (깃헙 참고)

# with cURL
curl -#fLo- 'https://raw.githubusercontent.com/hyperupcall/autoenv/main/scripts/install.sh' | sh

# with wget
wget --show-progress -o /dev/null -O- 'https://raw.githubusercontent.com/hyperupcall/autoenv/main/scripts/install.sh' | sh

사용하고자하는 폴더에가서, VLGuard2라는 아나콘다 환경을 활성화하고 싶다면 

echo "conda activate VLGuard2" > .env

이렇게 설정한 이후에 폴더를 터미널상에서 나갔다 들어오면 아래 그림처럼 activate 된다. 아래화면이 뜬다면 y 누르면 그 이후부터 자동으로 폴더에 들어갈때마다 실행될 것이다.

 

## Reference

https://github.com/hyperupcall/autoenv

https://beomi.github.io/2017/07/16/Use-Autoenv/

 

728x90
반응형