[PYTHON] Solution to the problem that you can't activate by putting conda in pyenv

reference

This was very helpful!

Introduction (Conclusion)

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

Synopsis

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

After all conda

Recommended Posts

Solution to the problem that you can't activate by putting conda in pyenv
A solution to the problem that the Python version in Conda cannot be changed
[Jinja2] Solution to the problem that variables added in the for statement are not inherited
A solution to the problem that files containing [and] are not listed in glob.glob ()
What to do if you can't use the trash in Lubuntu 18.04.
Solution to the problem that the display is corrupted when the .exe command is included in the while loop in wsl2
How to solve the problem that time goes wrong every time you turn on the power in Linux
A note that you want to manually decorate the parameters passed in the Django template form item by item
Solution to the problem that Ctrl + z cannot be used in Powershell in Docker for windows environment (provisional)
If you feel that you can't find the Object Inspector in recent Spyder
Handle CSV that contains the element you want to parse in the file name
[Python] Solution to the problem that elements are linked when copying a list
What to do if you can't hit the arrow keys in the Python interactive console
Jedi-vim shortcut command that allows you to refer to the definition source and definition destination in Python
Solved: Recognize the painful fact that if you can't do this in 10 minutes, you can't really program.
[VLC] How to deal with the problem that it is not in the foreground during playback
Temporary solution to the problem that the exe file created by PyInstaller is mistaken as a Trojan horse virus by AVAST or AVG
That ... can't you see the process you're running? The reason for
Finding a solution to the N-Queen problem with a genetic algorithm (2)
Move what you installed with pip to the conda environment
Try to extract the keywords that are popular in COTOHA
I can't log in to the admin page with Django3
What to do if you can't log in as root
A memo that solves the knapsack problem by the greedy algorithm
Finding a solution to the N-Queen problem with a genetic algorithm (1)