DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 964,423 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
kgoedert
kgoedert

Posted on • Originally published at dev.to

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

Top comments (2)

Collapse
 
romkatv profile image
Roman Perepelitsa

There is powerlevel10k now. You might want to upgrade.

Collapse
 
rediffusion profile image
rediffusion • Edited on

Yes, and it's faster!

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. ๐Ÿ›