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
- Install virtualenvwrapper
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 ~/.zshrc
and:
- 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)
There is powerlevel10k now. You might want to upgrade.
Yes, and it's faster!