I have been using pyenv for managing python versions and virtual environments on my mac for some time now. Recently I reinstalled pyenv and since then on every pyenv command I try to run, I get the following error
/usr/local/bin/pyenv:94: command not found: shopt My default shell is the latest MacOS's default shell i.e. zsh.
On searching for the fix, I found out it has something to do with bash interfering with the zsh.
My default shell is zsh in settings, the contents of ~/.bash_profile, /etc/profile & /etc/bashrc are all commented out but I am still having the issue.
My OS Verion is: 10.15.4.
I tried reinstalling pyenv as well but I am getting the same error.
I am unable to run ANY pyenv related command.
Edit 1
I already have these lines in my .zshrc as per the documentation, but as you can see, even this run a command pyenv root and this gives me the same shopt error.
export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$(pyenv root)/shims:$(pyenv root)/completions/pyenv.zsh:$PATH" Edit 2
Run
envand add the output in your question
TMPDIR=/var/folders/gm/t0h6v8jx4bqd6cj73_k27myw0000gp/T/ XPC_FLAGS=0x0 TERM_PROGRAM_VERSION=433 TERM_PROGRAM=Apple_Terminal XPC_SERVICE_NAME=0 TERM_SESSION_ID=55A65E3A-9B71-4C8A-81B8-0170EEAE3DCE TERM=xterm-256color SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.j6zkqCw6Of/Listeners SHELL=/bin/zsh HOME=/Users/abc LOGNAME=abc USER=abc PATH=/usr/local/opt/[email protected]/bin:/Users/saadali/Library/Python/3.7/bin:/usr/local/Cellar/[email protected]/9.6.16/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/abc/bin:/usr/local/opt/rabbitmq/sbin SHLVL=1 PYTHONPATH= LANGUAGE=en_US.UTF-8 port= LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 CPPFLAGS=-I/usr/local/opt/[email protected]/include LDFLAGS=-L/usr/local/opt/[email protected]/lib CFLAGS=-I/usr/local/opt/[email protected]/include LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 _=/usr/bin/env Edit 3
Please read this chat first before recommending to try something, as I might have already tried it. Chat starts at Apr 29 02:01 UTC +5 and then moves to a thread.
Edit 4
After setting PYENV_DEBUG=1, here the output
(vmds) saadali@A006-00276 ~ :~$ pyenv + [:22] enable -f /../libexec/pyenv-realpath.dylib realpath + [:29] [ -z '' ']' + [:31] READLINK=+ [:31] type -p greadlink readlink + [:31] READLINK=+ [:31] head -1 + [:31] READLINK='greadlink not found' + [:32] [ -n 'greadlink not found' ']' + [:57] [ -z '' ']' + [:58] PYENV_ROOT=/Users/abc/.pyenv + [:62] export PYENV_ROOT + [:65] [ -z '' ']' + [:66] [ -n '' ']' + [:82] [ -z '' ']' + [:83] PYENV_DIR=/Users/abc + [:86] [ ! -d /Users/abc ']' + [:86] [ ! -e /Users/abc ']' + [:90] PYENV_DIR=+ [:90] cd /Users/abc + [:90] echo /Users/abc + [:90] PYENV_DIR=/Users/abc + [:91] export PYENV_DIR + [:94] shopt -s nullglob /usr/local/bin/pyenv:94: command not found: shopt
/usr/local/bin/pyenv?which shopt?envand add the output of the same to your question#!/usr/bin/env bashbut this problem happens in bash terminal too.shoptis an internalbashcommand, onzshoutput ofwhich shoptis of course command not found, onbashterminal it returns nothing as it's not a command, but if I do simpleshopt, it shows some shopt related stuff.