allenfrostline

Bad Interpreter Error of Jupyter and its Solution


2019-04-17

I always wanna clean up my dev environment thoroughly, once for good. After all these years messing up with virtualenv, conda, pip as well as all the other languages than Python: R, Java, Node.js, Julia, Golang… My computer finally started going nuts. Jupyter notebook threw me the following error every time I start it:

zsh: /usr/local/bin/jupyter: bad interpreter: /usr/local/opt/python/bin/python3.7: no such file or directory

It turns out that the cause was that along with reinstallation of Python, the homebrew symlinks to Jupyter are now broken. A simple solution would be

rm '/usr/local/bin/jupyter'
brew install jupyter
brew link --overwrite jupyter
brew link --overwrite --dry-run jupyter
brew unlink jupyter && brew link jupyter

Then the notebook starts just fine.