Home > Back-end >  Which Python3 version the system will choose when I type "python3" in terminal
Which Python3 version the system will choose when I type "python3" in terminal

Time:11-02

On my Linux server. My python version is python3.6.5. I run my python files by typing python3 [.py file] in terminal to use python3.6.5.

However, after I download Anaconda3 on server, the python version change to python3.8.8(type python3 --version it shows python3.8.8)

So I guess Anaconda modified ~/.bashrc to change my python version(actually I am not sure which file Anaconda has modified)

I am trying to add export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.6/site-packages to change python3 version back to python3.6.5. But it didn't work.(type python3 --version it still show python3.8.8)

I would like to know which Python3 version the system will choose when I type python3 in terminal. How can I change my python3 version back to python3.6.5(python3 --version python3.6.5)

my ~/.bashrc:


export PATH=$HOME/bin:/bin:/usr/bin:/usr/local/bin:/opt/bin
export MAIL=/var/spool/mail/$USER

if [ $(uname -s) = 'SunOS' ]; then
    export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.6/site-packages

    export PATH=$PATH:/usr/ucb:/usr/ccs/bin:/usr/local/workshop/bin
    export PATH=$PATH:/usr/X11R6/bin:/usr/X11R5/bin:/usr/openwin/bin

    export MANPATH=/usr/man:/usr/local/man:/usr/X11R6/man:/usr/X11R5/man:/usr/motif1.2/man:/usr/share/catman:/opt/SUNWspro/man

    # for CXterm
    export HZINPUTDIR=/usr/X11R6/lib/X11/cxterm.dic
    export HBFPATH=/usr/local/chinese/fonts/cnprint:/usr/X11R6/lib/X11/fonts/chpower
    alias b5hztty='hztty -O hz2gb:gb2big -I big2gb:gb2hz'
fi

export PS1='\h:\w> '

alias ls='ls -aF'
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
ulimit -c 0
umask 077

#Cache Server
...


##
## put command run after interactive login in ~/.bash_profile
##

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

CodePudding user response:

You can create alias that call python3 and pointing to python 3.6.

alias python3='directory to python 3.6'

  • Related