pytorch的官方中文教程,执行到下面的代码就报错:
我进行安装transformer:
!pip install transforms
代码部分:
import transforms as T
def get_transform(train):
transforms = []
transforms.append(T.ToTensor())
if train:
transforms.append(T.RandomHorizontalFlip(0.5))
return T.Compose(transforms)
报错代码:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-11-8f09a7ff1c98> in <module>
----> 1 import transforms as T
2
3 def get_transform(train):
4 transforms = []
5 transforms.append(T.ToTensor())
~/.local/lib/python3.6/site-packages/transforms/__init__.py in <module>
----> 1 from .safe_html import safe_html, bodyfinder
2
3 # modules = [
4 # 'st', # zopish
5 # 'rest', # docutils
~/.local/lib/python3.6/site-packages/transforms/safe_html.py in <module>
----> 1 from sgmllib import SGMLParser, SGMLParseError
2 import re
3 from cgi import escape
4
5 from .utils import safeToInt
ModuleNotFoundError: No module named 'sgmllib'