UMN CDMS Wiki archive
start › run_68 › run_68_sims › py3

Anthony's Python3 Setup

Collection of notes on how to switch over to using Anthony's Python3 environment. Note if you have any existing python stuff set up, this will supplant it. If you have existing code that runs in other python/conda installs, you'll have to switch back to those environments before running such code.

Modify your .bashrc to replace any existing python setup include the following lines:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/phys/villaa/python/anaconda3_2019/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/phys/villaa/python/anaconda3_2019/etc/profile.d/conda.sh" ]; then
        . "/home/phys/villaa/python/anaconda3_2019/etc/profile.d/conda.sh"
    else
        export PATH="/home/phys/villaa/python/anaconda3_2019/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

Also add this line to your .bashrc:

export PYTHONSTARTUP=~/.python3rc

Further, create the file ~/.python3rc with the following content:

import os.path

#whatever directory you start in execute the .pyenv script
if(os.path.isfile('.pyenv')):
  exec(open('.pyenv').read())