【发布时间】:2018-11-27 16:19:24
【问题描述】:
我有一个模块 (tqdm),我需要根据我是在 jupyter notebook 还是 jupyter lab 环境中运行 .ipynb 来以不同的方式导入它。有没有办法我可以在 python 中确定这一点?例如:
if <jupyter notebook>:
from tqdm import tqdm_notebook as tqdm
elif <jupyter lab>:
from tqdm import tqdm
else:
print("Not in jupyter environment.")
【问题讨论】:
标签: python-3.x jupyter-notebook jupyter-lab