Friday, February 25, 2022

[SOLVED] add Pyenv commands to bashrc or zshrc?

Issue

This tutorial to create virtual environments suggests, that I should add these commands to my .bashrc file:

eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

On the home directory of my macOS, when I check for ls -a, I do not see a .bashrc file. I do see however a .zshrc file. Is this an alternative? Can I put the commands here or should I create a new .bashrcfile in my home directory using nano or similar?


Solution

You should run echo $0 to check which shell you're using, but I would be fairly certain no .bashrc means no bash shell in use. If you're using a later version of macOS then zsh will be in use already as the default shell (but bash is in use on older versions pre-Catalina by default).

If echo $0 does output bash or /bin/bash rather than zsh or /bin/zsh then you should create a .bashrc file and put the commands in it - but if your output contains zsh, then you should put the commands in the .zshrc file already in existence.



Answered By - Jack Bashford
Answer Checked By - Robin (WPSolving Admin)