Google Colab Ngrok转换为python [英] Google Colab ngrok convert to python
问题描述
我有一个带以下命令的Google Colab笔记本
I have a Google Colab notebook with following commands
!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip ngrok-stable-linux-amd64.zip
LOG_DIR = './log'
get_ipython().system_raw(
'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &'
.format(LOG_DIR)
)
这些命令运行良好,在Google Colab中没有任何错误。但是当我在python中运行相同命令时出现错误。
These commands run very well without any error in Google Colab . But when I run the same in python get error.
Python demo.py
Python demo.py
import sys, json
import requests
from IPython import get_ipython
import requests
LOG_DIR = './log'
get_ipython().system_raw(
'tensorboard --logdir {} --host 0.0.0.0 --port 8001 &'
.format(LOG_DIR)
)
错误:第9行:AttributeError:'NoneType'对象没有属性'system_raw'
ERROR: line 9: AttributeError: 'NoneType' object has no attribute 'system_raw'
我该如何解决python中的错误?
How do I resolve this error in python ?
推荐答案
我建议尝试使用 pyngrok
之类的程序来管理您的 ngrok
隧道适合您吗?完全公开,我是它的开发者。 如果您有兴趣,这里是文档。
Might I suggest trying something like pyngrok
to programmatically manage your ngrok
tunnel for you? Full disclosure, I am the developer of it. Here are the docs if you're interest.
这篇关于Google Colab Ngrok转换为python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!