In conclusion, you should set the environment path to read conda before pyenv.
Added to rc file
# -------------------------------------------------------------------------
# pyenv
# -------------------------------------------------------------------------
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
# -------------------------------------------------------------------------
# conda
# -------------------------------------------------------------------------
export PATH="$PYENV_ROOT/versions/Conda version/bin:$PATH"
Changes to pyenv global
do not apply in because python in .pyenv / versions / conda / bin
is called before pyenv
Put conda in pyenv
pyenv install conda version
To make conda global with pyenv
pyenv global conda version
Creating an environment with conda
conda -n Environment name
I want to activate the created virtual environment I want to switch to the environment created from base
Check the current active environment
conda env list
# conda environments:
#
base * /home/username/.pyenv/versions/anaconda3-2019.10
create_new_env /home/username/.pyenv/versions/anaconda3-2019.10/envs/create_new_env
Try to switch
conda activate environment name
I get this error
Usage: pyenv which <command>
pyenv also has an activate command, so it's used differently! Get angry
So make sure conda is loaded before pyenv
Added to rc file
export PATH="$PYENV_ROOT/versions/anaconda3-version/bin:$PATH"
Check PATH
echo $PATH
/home/username/.pyenv/versions/anaconda3-2019.10/bin:/home/username/.pyenv/shims:/home/username/.pyenv/bin
OK if it looks like this
If you hit the environment switching command again, it will work.
Switch with your favorite command
conda activate environment name
source activate environment name
Recommended Posts