DEV Community

kgoedert
kgoedert

Posted on • Originally published at dev.to

11

Setup python 3 environment on mac with zsh

Trying to setup my development enviroment on a mac, I had some problems, specially integrating my virtual environment information on my shell. On zsh specifically, with oh my zsh. The theme am I using is PowerLevel9k

The steps that worked:

Installation

  • Install homebrew

  • Install python 3 and pip 3 with brew. Installing python 3 also installs pip3

brew install python3
sudo pip3 install virtualenvwrapper

Usually in python projects you do not install packages with sudo, but this way virtualenvwrapper will be installed globally and available to all the projects

ZSH Configuration

Edit your ~/.zshrcand:

  • Enable virtualenv plugin on .zshrc
 plugins=(...virtualenv)
  • Set python 3 as the default for virtualenvwrapper
export VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
  • Load virtualenvwrapper script
source /usr/local/bin/virtualenvwrapper.sh
  • To be able to show the active virtualenv on the prompt add (I just added the virtualenv, the others are the default ones)
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs virtualenv)
  • Edit your ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh and comment out the line
export VIRTUAL_ENV_DISABLE_PROMPT=1
  • source your zsh
source ~/.zshrc

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (2)

Collapse
 
romkatv profile image
Roman Perepelitsa

There is powerlevel10k now. You might want to upgrade.

Collapse
 
rediffusion profile image
rediffusion • Edited

Yes, and it's faster!

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up