ubuntu16.04切换自带python以及anaconda虚拟环境下python

使用alias来对每个python版本重新命别名,终端调用别名即可进入相应python,具体操作如下:

1、编辑环境

sudo gedit ~/.bashrc

在打开的编辑器末尾输入以下红字内容:

# added by Anaconda3 installer

export PATH="export PATH="/home/hst/anaconda3/bin:$PATH"   #base环境下的python
export PATH="export PATH="/home/hst/anaconda3/envs/tensorflowAPI/bin:$PATH"   #虚拟环境tensorflowAPI环境下的python
export PATH="usr/bin/python2.7:$PATH"  #ubuntu自带python
export PATH="usr/bin/python3.5:$PATH"  #ubuntu自带python

alias python1="/home/hst/anaconda3/bin/python

alias python2="/home/hst/anaconda3/envs/tensorflowAPI/bin/python

alias python3='/usr/bin/python2.7'

alias python4='/usr/bin/python3.5'

2、使得~/.bashrc的修改生效

source ~/.bashrc

3、终端输入:

python1------》进入base下python

python2------》进入虚拟环境tensorflowAPI下python

python3------》进入ubuntu自带python

python4------》进入ubuntu自带python

你可能感兴趣的:(Ubuntu系统,Python,深度学习)