第一步:初始化coda
命令:sudo gedit ~/.bashrc
第二部:复制其中这样一段代码
# >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/yourhostname/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/home/yourhostname/anaconda3/etc/profile.d/conda.sh" ]; then . "/home/yourhostname/anaconda3/etc/profile.d/conda.sh" else export PATH="/home/yourhostname/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<<
第三部:在结尾处添加
conda activate pyn_env
shellScriptPath="/home/xx/"
cd "$shellScriptPath"
python3 xx.py > test.log 2>&1 &