Search code examples
pythoncondazshpyenv

Pyenv and Conda coexisting


I want to use pyenv and conda. Pyenv for managing my python versions and conda mostly for Jupiter Notebook. However, every time I use conda it overrides pyenv paths and sets local python version for it's one.

This is the .zshrc file on my MacBook pro with os 12 on it.

#<<<<<<<<<<<<<<<<CONDA>>>>>>>>>>>>>>>>>
export PATH="/Users/potato/anaconda3/bin:$PATH"
#<<<<<<<<<<<<<<<<CONDA>>>>>>>>>>>>>>>>>

#<<<<<<<<<<<<<<<<PYENV>>>>>>>>>>>>>>>>>
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PATH="$HOME/.pyenv/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include"
#<<<<<<<<<<<<<<<<PYENV>>>>>>>>>>>>>>>>>

I tried different solutions like this: Installing anaconda with pyenv, unable to configure virtual environment

Still doesn't work

Ideally, I would want to just switch from python to conda and be able to use Jupiter notebook, then when I'm done write a simple command that would return to pyenv control of versions.


Solution

  • Thank you merv.

    I could've done it much easier.

    Here's what I did.

    I created virtualenv with pyenv, downloaded jupyter notebook with pip while in the virtual environment and voila, so easy. Almost like I didn't have to download whole anaconda to do it XD