编写目的:
1、工作环境需要python2.7的环境,并且最好不要让anaconda3 的环境变量使能;
2、深度学习需要anaconda3 python3.6 + jupyter notebook的环境,支持终端jupyter notebook命令打开,就需要使环境变量使能;
切来切去是很麻烦,索性写个脚本,也顺便练练手吧。下面是脚本内容:
#!/bin/bash
# Copyright (c) Moli_sama
echo "change anaconda3 PATH enable? (y/n)"
read selected_case
case $selected_case in
y)
#apply Anaconda3 PATH to enable command 'jupyter notebook' etc.
echo 'Please select a version of python : (recommand python 3.6)'
export PATH="/home/jason/anaconda3/bin:$PATH"
sudo update-alternatives --config python
echo 'Restart terminal to apply changes~'
;;
n)
#change python version to default, for work project
echo 'Please select a version of python : (recommand python 2.7)'
source .bashrc
echo 'Apply .bashrc'
sudo update-alternatives --config python
echo 'Restart terminal to apply changes~'
;;
esac
以上脚本仅做自己使用,有需要的拿着用就好,有什么问题或者建议欢迎留言呐~