使用conda安装torchtext

问题描述

  在使用《动手学深度学习》中导入包的时候有一个包torchtext导入出现了问题,原来是没有装。但是直接使用conda install存在无法安装的情况,这时候需要指定channel

问题解决:手动指定channel

方法一:使用conda cloud给出的channel,github的pytorch库也推荐了这个channel,建议去github了解一下,还详细说明了版本等其他问题。

conda install -c pytorch torchtext

方法二:(有网友推荐这个channel,我个人失败了)

conda install -c derickl torchtext

方法三:直接用pip安装zip文件,你也可以直接把zip文件下载下来pip安装,只要注意指定好路径,比如"pip install ./xxx.zip"(注意conda不支持zip安装,只支持tar格式的压缩包安装)

pip install torchtext
# or
pip install https://github.com/pytorch/text/archive/master.zip

猜你喜欢

转载自blog.csdn.net/qq_34769162/article/details/107714966