April 14, 2024, 11:29 p.m. | Min ho Kim

DEV Community dev.to




1. Create a function in the .zshrc



# ~/.zshrc
activate() {
if [ -d ".venv" ]; then
source .venv/bin/activate
else
: # ignore if no .venv
fi
}





2. Set iTerm to call this function on a new tap


iTerm2: Preferences -> Profiles -> Command: Login Shell -> Send text at start: "activate"


https://minho42.com/posts/auto-activate-venv-on-iterm/

call command create environment function login profiles python set shell text venv virtual

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Data Scientist

@ Publicis Groupe | New York City, United States

Bigdata Cloud Developer - Spark - Assistant Manager

@ State Street | Hyderabad, India