1、方法1
在shell中利用export指定python解释器路径
编写如下run.sh文件,内容如下
#!/bin/bash
export PATH=/root/anaconda3/bin$path
nohup python -u 文件名.py >>out.log 2>&1 &
- 1
- 2
- 3
- 4
2、方法2
利用conda激活虚拟环境,进入文件执行目录执行。
#! /bin/bash
conda activate 虚拟环境名
cd 待执行脚本文件路劲
nohup python -u 文件名.py >>out.log 2>&1 &
- 1
- 2
- 3
- 4