Create an environment with Anaconda with python version 3.8.5.
However, when I run conda, the python version is 2.7.16.
(base) renato@MacBook-Pro ~ % conda activate renatoenv
(renatoenv) renato@MacBook-Pro ~ % python --version
Python 2.7.16
① Reinstall Anaconda ② Install pyenv
Since it did not change even if I did ①, I will omit it as an article. I will explain ②.
It's a tool that makes it easy to switch between python versions. It is convenient for switching between 2 series and 3 series.
First, let's install pyenv. If you bring it from git, you can use the above command, and if you can use brew, you can use the command below.
$ git clone git://github.com/yyuu/pyenv.git ~/.pyenv
$ brew install pyenv
Edit bash_profile Then edit bash_profile to get it through the path of pyenv.
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
Finally apply the save of bash_profile
$ source ~/.bash_profile
Then the Python version changed.
(base) renato@MacBook-Pro ~ % conda activate renatoenv
(renatoenv) renato@MacBook-Pro ~ % python --version
Python 3.8.5
This article was written with reference to the following information.
-Installing and using pyenv, what to do if you can't switch python versions
Recommended Posts