nltk.download() Errno 61 和 Proxy 问题。

问题描述 投票:0回答:1

我在Python中导入nltk后,试图从nltk中下载包。它产生了以下错误。

enter image description here

然后我尝试了 nltk.set_proxy 因为我使用的是中国的代理服务器。但是,我使用的代理服务器没有用户名和密码。所以我的代码是这样的 nltk.set_proxy('http://proxy.example.com:3128') 当我运行 nltk.download() 又是它产生的错误信息。

 Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    nltk.download()
  File "/Users/zbao/Library/Python/3.8/lib/python/site-packages/nltk/downloader.py", line 773, in download
    self._interactive_download()
  File "/Users/zbao/Library/Python/3.8/lib/python/site-packages/nltk/downloader.py", line 1123, in _interactive_download
    DownloaderGUI(self).mainloop()
  File "/Users/zbao/Library/Python/3.8/lib/python/site-packages/nltk/downloader.py", line 1423, in __init__
    self._fill_table()
  File "/Users/zbao/Library/Python/3.8/lib/python/site-packages/nltk/downloader.py", line 1755, in _fill_table
    items = self._ds.collections()
  File "/Users/zbao/Library/Python/3.8/lib/python/site-packages/nltk/downloader.py", line 600, in collections
    self._update_index()
  File "/Users/zbao/Library/Python/3.8/lib/python/site-packages/nltk/downloader.py", line 962, in _update_index
    ElementTree.parse(urlopen(self._url)).getroot()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1362, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1319, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1230, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1276, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1225, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1004, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 944, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1392, in connect
    super().connect()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 920, in connect
    self._tunnel()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 894, in _tunnel
    (version, code, message) = response._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 285, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: <html

有人知道问题出在哪里吗?先谢谢了!

python nlp nltk
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.