【发布时间】:2021-06-06 20:11:24
【问题描述】:
我做了以下事情:
!pip install pytorch_lightning -qqq
import pytorch_lightning
但是得到以下错误:
ImportError Traceback (most recent call last)
<ipython-input-7-d883b15aac58> in <module>()
----> 1 import pytorch_lightning
----------------------------------9 frames------------------------------------------------
/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/apply_func.py in <module>()
26
27 if _TORCHTEXT_AVAILABLE:
---> 28 from torchtext.data import Batch
29 else:
30 Batch = type(None)
ImportError: cannot import name 'Batch' from 'torchtext.data' (/usr/local/lib/python3.7/dist-packages/torchtext/data/__init__.py)
可能是什么问题?
【问题讨论】:
-
你试过用
pip install安装吗?? -
是的,如果你看第一行的话。
-
试试下面的
!pip install torch pytorch-lightning
标签: python pytorch google-colaboratory pytorch-lightning