Home > Net >  Set python 3.10 environment on mac with vs code and anaconda paths
Set python 3.10 environment on mac with vs code and anaconda paths

Time:04-26

I'm working with vs code on python 3.7.4 and I have anaconda installed on my mac. Now I installed python 3.10 and I can switch the environment in vs code, but the terminal is still on 3.7.4, so that I can't pip install any libraries onto the 3.10 version right away. How do I have to set up the PATH to use 3.10 as the standard installation in my terminal?

I also don't know if I should use bash or zsh.
Anaconda doesn't let me add an environment with python 3.10

3.10 installation is /usr/local/bin/python3

echo $PATH: /opt/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin

These are the profiles:

cd && touch .zprofile && open .zprofile:

# Setting PATH for Python 3.8
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH

# Setting PATH for Python 3.10
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.10/bin:${PATH}"
export PATH

cd && touch .bash_profile && open .bash_profile:

# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

CodePudding user response:

Different versions of anconda correspond to different versions of Python. When you upgrade Python to 3.10, anconda also needs a new version. Here is the download page

  • Related