torchtext的安装

在学习《动手深度学习》的过程中,安装torchtext出了问题。
前面的尝试的错误有:
1.使用pip直接安装

pip install torchtext

结果出现以下的错误

Traceback (most recent call last):
  File "C:\Users\Administrator\Anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 425, in _error_catcher
    yield
  File "C:\Users\Administrator\Anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 507, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "C:\Users\Administrator\Anaconda3\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "C:\Users\Administrator\Anaconda3\lib\http\client.py", line 457, in read
    n = self.readinto(b)
  File "C:\Users\Administrator\Anaconda3\lib\http\client.py", line 501, in readinto
    n = self.fp.readinto(b)
  File "C:\Users\Administrator\Anaconda3\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\Administrator\Anaconda3\lib\ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\Administrator\Anaconda3\lib\ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

2.然后我又尝试了通过anaconda安装

conda install -c derickl torchtext

结果还是报错误。
3.然后还有通过github下载,结果仍然报错

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

最后通过清华的镜像直接安装解决了这个问题

pip install torchtext -i https://pypi.tuna.tsinghua.edu.cn/simple

torchtext的安装_第1张图片

你可能感兴趣的:(python学习)