本文介绍了如何在virtualenv中从python scipt运行Tensorboard?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Tensorboard应该从这样的公共行开始:
Tensorboard should be started from commnad line like that:
tensorboard --logdir=path
我需要从代码运行它.到现在为止,我都使用这个:
I need to run it from code. Until now I use this:
import os
os.system('tensorboard --logdir=' + path)
但是,由于系统路径中未包含张量板,因此无法启动.我在Windows上将PyCharm与virtualenv一起使用.我不想更改系统路径,因此唯一的选择是从virtualenv运行它.这该怎么做?
However tensorboard do not start because is not included in the system path. I use PyCharm with virtualenv on windows. I don't want to change system paths so the only option is to run it from virtualenv. How to do this?
推荐答案
使用Tensorboard 2 API(2019):
Using Tensorboard 2 API (2019):
from tensorboard import program
tb = program.TensorBoard()
tb.configure(argv=[None, '--logdir', tracking_address])
url = tb.launch()
注意:tb.launch()创建一个守护进程线程,该线程将在进程完成后自动终止
Note: tb.launch() create a daemon thread that will die automatically when your process is finished
这篇关于如何在virtualenv中从python scipt运行Tensorboard?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!