最近在弄一个OCR的课设,其中需要用到实现Beam Search功能的CTC层.由于是使用Pytorch,所以在网上找到了CTCENCODE这个库.本人的环境是:Manjaro+Anaconda+Python3.8.
但是在安装过程中(cd到ctcdecode目录后运行$ pip install .
后)遇到了以下报错:
Traceback (most recent call last):
File "setup.py", line 29, in <module>
download_extract('https://github.com/parlance/ctcdecode/releases/download/v1.0/boost_1_67_0.tar.gz',
File "setup.py", line 17, in download_extract
urllib.request.urlretrieve(url, dl_path)
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/urllib/request.py", line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/urllib/request.py", line 1397, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/urllib/request.py", line 1358, in do_open
r = h.getresponse()
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/http/client.py", line 1344, in getresponse
response.begin()
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/http/client.py", line 307, in begin
version, status, reason = self._read_status()
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/http/client.py", line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/home/tsuipo/miniconda3/envs/torch/lib/python3.8/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer
为了解决这个报错懒癌的我甚至配置完了之前懒得配置的Q2ray,配置了全局代理,但问题仍未解决.这时候我怒了…
灵机一动,$ pip install urllib3
,然后再运行$ pip install .
问题解决!!!
忙活一上午装了一个包,啥也没做,很开心.