安装hanlp后测试是否安装成功,出现了socket.gaierror和urllib.error.URLError

:sob: 请教下大家,是否遇到过这样的问题:

按照install教程,pip安装了hanlp,conda list如下:

# packages in environment at /conda/envs/han:
#
# Name                    Version                   Build  Channel
blas                      1.0                         mkl    defaults
ca-certificates           2022.07.19           h06a4308_0    defaults
certifi                   2022.6.15        py38h06a4308_0    defaults
charset-normalizer        2.1.1                     <pip>
dbus                      1.13.18              hb2f20db_0    defaults
expat                     2.4.4                h295c915_2    defaults
freetype                  2.11.0               h70c0345_0    defaults
glib                      2.69.1               h4ff587b_1    defaults
hanlp-downloader          0.0.25                    <pip>
idna                      3.3                       <pip>
intel-openmp              2021.4.0          h06a4308_3561    defaults
jpype1                    0.7              py38h9de70de_0    http://data-source-conda.sankuai.com/cloud/conda-forge
ld_impl_linux-64          2.38                 h1181459_1    defaults
libffi                    3.3                  he6710b0_2    defaults
libgcc-ng                 11.2.0               h1234567_1    defaults
libpng                    1.6.37               hbc83047_0    defaults
libstdcxx-ng              11.2.0               h1234567_1    defaults
libxcb                    1.15                 h7f8727e_0    defaults
mkl                       2021.4.0           h06a4308_640    defaults
mkl-service               2.4.0            py38h7f8727e_0    defaults
mkl_fft                   1.3.1            py38hd3c417c_0    defaults
mkl_random                1.2.2            py38h51133e4_0    defaults
ncurses                   6.3                  h5eee18b_3    defaults
numpy                     1.23.1           py38h6c91a56_0    defaults
numpy-base                1.23.1           py38ha15fc14_0    defaults
openjdk                   11.0.13              h87a67e3_0    defaults
openssl                   1.1.1q               h7f8727e_0    defaults
pcre                      8.45                 h295c915_0    defaults
pip                       22.1.2           py38h06a4308_0    defaults
pyhanlp                   0.1.84                    <pip>
python                    3.8.13               h12debd9_0    defaults
readline                  8.1.2                h7f8727e_1    defaults
requests                  2.28.1                    <pip>
setuptools                63.4.1           py38h06a4308_0    defaults
six                       1.16.0             pyhd3eb1b0_1    defaults
sqlite                    3.39.2               h5082296_0    defaults
tk                        8.6.12               h1ccaba5_0    defaults
urllib3                   1.26.12                   <pip>
wheel                     0.37.1             pyhd3eb1b0_0    defaults
xz                        5.2.5                h7f8727e_1    defaults
zlib                      1.2.12               h5eee18b_3    defaults

然后测试是否安装成功时报错

$ hanlp
Traceback (most recent call last):
  File "/conda/envs/han/lib/python3.8/urllib/request.py", line 1354, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/conda/envs/han/lib/python3.8/http/client.py", line 1256, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/conda/envs/han/lib/python3.8/http/client.py", line 1302, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/conda/envs/han/lib/python3.8/http/client.py", line 1251, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/conda/envs/han/lib/python3.8/http/client.py", line 1011, in _send_output
    self.send(msg)
  File "/conda/envs/han/lib/python3.8/http/client.py", line 951, in send
    self.connect()
  File "/conda/envs/han/lib/python3.8/http/client.py", line 922, in connect
    self.sock = self._create_connection(
  File "/conda/envs/han/lib/python3.8/socket.py", line 787, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/conda/envs/han/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/conda/envs/han/bin/hanlp", line 5, in <module>
    from pyhanlp.main import main
  File "/conda/envs/han/lib/python3.8/site-packages/pyhanlp/__init__.py", line 149, in <module>
    _start_jvm_for_hanlp()
  File "/conda/envs/han/lib/python3.8/site-packages/pyhanlp/__init__.py", line 41, in _start_jvm_for_hanlp
    from pyhanlp.static import STATIC_ROOT, hanlp_installed_data_version, HANLP_DATA_PATH
  File "/conda/envs/han/lib/python3.8/site-packages/pyhanlp/static/__init__.py", line 285, in <module>
    install_hanlp_jar()
  File "/conda/envs/han/lib/python3.8/site-packages/pyhanlp/static/__init__.py", line 160, in install_hanlp_jar
    jar_version, jar_url, data_version, data_url = hanlp_latest_version()
  File "/conda/envs/han/lib/python3.8/site-packages/pyhanlp/static/__init__.py", line 71, in hanlp_latest_version
    return hanlp_releases()[0]
  File "/conda/envs/han/lib/python3.8/site-packages/pyhanlp/static/__init__.py", line 83, in hanlp_releases
    content = urllib.urlopen(req).read()
  File "/conda/envs/han/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/conda/envs/han/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/conda/envs/han/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/conda/envs/han/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/conda/envs/han/lib/python3.8/urllib/request.py", line 1383, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/conda/envs/han/lib/python3.8/urllib/request.py", line 1357, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

不知道这个该怎么解决 :sob: