我在ubuntu 16.04 VPS上使用fabric和python 3.6。如果我使用bash并使用bash,我可以这样做:
deploy@server:~$ conda info --envs
# conda environments:
#
python-devel /home/deploy/miniconda3/envs/python-devel
test /home/deploy/miniconda3/envs/test
root * /home/deploy/miniconda3
deploy@server:~$ source activate test
(test) deploy@server:~$
我有以下结构功能:
def _update_conda_env(site_folder, host):
......
run(f'source ~/miniconda3/bin/activate test')
run(f'~/miniconda3/bin/conda info --envs')
给出输出:
[deploy@mysite.org] run: source ~/miniconda3/bin/activate test
[deploy@mysite.org] run: ~/miniconda3/bin/conda info --envs
[deploy@mysite.org] out: # conda environments:
[deploy@mysite.org] out: #
[deploy@mysite.org] out: python-devel /home/deploy/miniconda3/envs/python-devel
[deploy@mysite.org] out: test /home/deploy/miniconda3/envs/test
[deploy@mysite.org] out: root * /home/deploy/miniconda3
[deploy@mysite.org] out:
[deploy@mysite.org] out:
Done.
Disconnecting from deploy@mysite.org... done.
如何在面料中使用
答案 0 :(得分:0)
除非您使用activate
,否则prefix
仅在一个周期内保持有效状态。
with prefix('source ~/miniconda3/bin/activate test'):
run(f'~/miniconda3/bin/conda info --envs')
这样,运行块中的所有内容都将以source ~/miniconda3/bin/activate test &&