报错信息
ImportError: dlopen(//spert/lib/python3.7/site-packages/torchtext/_torchtext.so, 2): Library not loaded: @rpath/libtorch_cpu.dylib
Referenced from: //spert/lib/python3.7/site-packages/torchtext/_torchtext.so
Reason: image not found
或
ImportError: cannot import name 'TextClassificationDataset' from 'torchtext.datasets' (//spert/lib/python3.7/site-packages/torchtext/datasets/__init__.py)
解决方法
首先,看一下这个表格,去对应自己正确的torchtext版本。
然后下载正确版本,conda install -c pytorch torchtext==0.x
[1] https://github.com/pytorch/text