Virtual Environments I: Installing Pyenv with Homebrew

If you’ve used Python before, you may have encountered a situation known as “dependency hell”. Some packages depend on other packages to work. Sometimes, the package that another package depends on must be a certain version. Later on, you might need to use a different version of that package because there is yet another package that depends on that package being another version. So the best way to avoid dependency hell and create professional projects is to use virtual environments.

a lego toy office worker frustrated in front of a tiny computer
Image by www_slon_pics from Pixabay

I. Installing Pyenv with Homebrew

$ brew update
$ brew install pyenv

II. Using Bash and Nano to Create a .bash_profile

$ ls -a
$ nano
screen shot of a nano file
screen shot of a nano file
screen shot of a nano file
echo ‘export PYENV_ROOT=”$HOME/.pyenv”’ >> ~/.bash_profile
echo ‘export PATH=”$PYENV_ROOT/bin:$PATH”’ >> ~/.bash_profile
eval “$(pyenv init -)”
 exec $SHELL

III. Using Pip to Install Virtualenv

$ pip3 install virtualenv
$ pip3 install virtualenvwrapper
$ brew install pyenv-virtualenv
eval “$(pyenv virtualenv-init -)”

IV. What Did We Do?

V. What’s Next?

🐍 Python Enthusiast 🐼 Pandas Aficionado ⭐ Experience NLP using SpaCy and NLTK 🔎 Relentlessly curious 👩🏻‍💻