Python: 调用命令行 source activate env

flask 项目 railway 其下
Faster_RCNN_for_US_test 需要激活另一个 rcnn 环境

1877813-0ee854d19c8daf15.png

test.sh

#!/usr/bin/env bash
source activate rcnn
conda info -e

test.py

import subprocess

shell = 'test.sh'
f = open(shell, 'r')
cmd = f.read()
subprocess.call(cmd, shell=True, executable='/bin/bash')

output

/new_disk_1/xs/anaconda3/envs/flask/bin/python3.6 /new_disk_1/xs/PycharmProjects/railway/test.py
# conda environments:
#
dota                     /new_disk_1/xs/anaconda3/envs/dota
flask                    /new_disk_1/xs/anaconda3/envs/flask
gluon                    /new_disk_1/xs/anaconda3/envs/gluon
rcnn                  *  /new_disk_1/xs/anaconda3/envs/rcnn
root                     /new_disk_1/xs/anaconda3


Process finished with exit code 0
展开阅读全文

没有更多推荐了,返回首页