-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
I am using pyenv 1.2.20 on Mac OS X 10.15.5 and I have two Python versions (3.6.11 and 3.8.5) installed via pyenv. The global python version is 3.8.5 and I have a project folder myproject configured with pyenv local to use version 3.6.11 instead. To enable automatic switching between python versions I'm executing eval "$(pyenv init -)" both in my .bashrc and .bash_profile. All this works fine when I use the Mac terminal emulator. python --version gives 3.6.11 when I'm inside myproject and 3.8.5 anywhere else.
However, if I start a jupyterlab server (outside of myproject) and use the terminal emulator from jupyterlab the python version I see is always 3.8.5, even if I'm inside myproject. Even if I manually run eval "$(pyenv init -)" in the jupyterlab terminal the switching still does not work.
I have noticed that the $PATH variable I see in the Mac OS terminal is different from the one in the jupyterlab terminal. The former is
/Users/wiebuschm/.local/opt/google-cloud-sdk/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/wiebuschm/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
while the latter is
/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/wiebuschm/.pyenv/shims:/Users/wiebuschm/.pyenv/versions/3.8.5/bin:/usr/local/Cellar/pyenv/1.2.20/libexec:/Users/wiebuschm/.local/opt/google-cloud-sdk/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/wiebuschm/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
However, I don't know what causes this difference and even if I manually set PATH in the jupyterlab terminal to be the same as in the Mac OS terminal it still won't automatically switch the Python version when I cd into myproject.