首页 > 解决方案 > 安装和运行聊天机器人时出现问题

问题描述

我尝试使用以下命令安装 chatterbot

pip3 install chatterbot

它将此错误返回给我


Collecting chatterbot
Using cached ChatterBot-1.0.5-py2.py3-none-any.whl (67 kB)
Requirement already satisfied: pint>=0.8.1 in ./venv/lib/python3.9/site-packages (from chatterbot) (0.17)
Collecting spacy<2.2,>=2.1
  Using cached spacy-2.1.9.tar.gz (30.7 MB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/pietrobon/Downloads/JJ/venv/bin/python /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-standalone-pip-r5_c98e2/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-build-env-tfkavy5n/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools 'wheel>0.32.0,<0.33.0' Cython 'cymem>=2.0.2,<2.1.0' 'preshed>=2.0.1,<2.1.0' 'murmurhash>=0.28.0,<1.1.0' 'thinc>=7.0.8,<7.1.0'
       cwd: None
  Complete output (261 lines):
  Collecting setuptools
    Using cached setuptools-57.4.0-py3-none-any.whl (819 kB)
  Collecting wheel<0.33.0,>0.32.0
    Using cached wheel-0.32.3-py2.py3-none-any.whl (21 kB)
  Collecting Cython
    Using cached Cython-0.29.24-cp39-cp39-macosx_10_9_x86_64.whl (1.9 MB)
  Collecting cymem<2.1.0,>=2.0.2
    Using cached cymem-2.0.5-cp39-cp39-macosx_10_9_x86_64.whl (32 kB)
  Collecting preshed<2.1.0,>=2.0.1
    Using cached preshed-2.0.1.tar.gz (113 kB)
  Collecting murmurhash<1.1.0,>=0.28.0
    Using cached murmurhash-1.0.5-cp39-cp39-macosx_10_9_x86_64.whl (18 kB)
  Collecting thinc<7.1.0,>=7.0.8
    Using cached thinc-7.0.8-cp39-cp39-macosx_10_9_x86_64.whl
  Collecting plac<1.0.0,>=0.9.6
    Using cached plac-0.9.6-py2.py3-none-any.whl (20 kB)
  Collecting tqdm<5.0.0,>=4.10.0
    Using cached tqdm-4.61.2-py2.py3-none-any.whl (76 kB)
  Collecting srsly<1.1.0,>=0.0.6
    Using cached srsly-1.0.5-cp39-cp39-macosx_10_9_x86_64.whl (179 kB)
  Collecting blis<0.3.0,>=0.2.1
    Using cached blis-0.2.4.tar.gz (1.5 MB)
  Collecting numpy>=1.7.0
    Using cached numpy-1.21.1-cp39-cp39-macosx_10_9_x86_64.whl (17.0 MB)
  Collecting wasabi<1.1.0,>=0.0.9
    Using cached wasabi-0.8.2-py3-none-any.whl (23 kB)
  Using legacy 'setup.py install' for preshed, since package 'wheel' is not installed.
  Using legacy 'setup.py install' for blis, since package 'wheel' is not installed.
  Installing collected packages: numpy, cymem, wasabi, tqdm, srsly, preshed, plac, murmurhash, blis, wheel, thinc, setuptools, Cython
      Running setup.py install for preshed: started
      Running setup.py install for preshed: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /Users/pietrobon/Downloads/JJ/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-install-3wuuouxg/preshed_dd0563dec5f54cb4a210a0676d307d73/setup.py'"'"'; __file__='"'"'/private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-install-3wuuouxg/preshed_dd0563dec5f54cb4a210a0676d307d73/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-record-0758mgue/install-record.txt --single-version-externally-managed --prefix /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-build-env-tfkavy5n/overlay --compile --install-headers /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-build-env-tfkavy5n/overlay/include/site/python3.9/preshed
           cwd: /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-install-3wuuouxg/preshed_dd0563dec5f54cb4a210a0676d307d73/
      Complete output (224 lines):
      WARNING: The wheel package is not available.
      running install
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-3.9
      creating build/lib.macosx-10.9-x86_64-3.9/preshed
      copying preshed/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/preshed
      copying preshed/about.py -> build/lib.macosx-10.9-x86_64-3.9/preshed
      creating build/lib.macosx-10.9-x86_64-3.9/preshed/tests
      copying preshed/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.9/preshed/tests
      copying preshed/tests/test_pop.py -> build/lib.macosx-10.9-x86_64-3.9/preshed/tests
      copying preshed/tests/test_counter.py -> build/lib.macosx-10.9-x86_64-3.9/preshed/tests
      copying preshed/tests/test_hashing.py -> build/lib.macosx-10.9-x86_64-3.9/preshed/tests
      copying preshed/counter.pyx -> build/lib.macosx-10.9-x86_64-3.9/preshed
      copying preshed/maps.pyx -> build/lib.macosx-10.9-x86_64-3.9/preshed
      copying preshed/maps.pxd -> build/lib.macosx-10.9-x86_64-3.9/preshed
      copying preshed/__init__.pxd -> build/lib.macosx-10.9-x86_64-3.9/preshed
      copying preshed/counter.pxd -> build/lib.macosx-10.9-x86_64-3.9/preshed
      running build_ext
      building 'preshed.maps' extension
      creating build/temp.macosx-10.9-x86_64-3.9
   








----- BLA BLA BLA TOO MANY ERRORS I REMOVE SOME THINGS OTHERWISE I CANNOT PUBLISH IT BECAUSE IT EXCEEDS THE LIMIT OF CHARACTERS----- 

      





      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      preshed/maps.cpp:6129:52: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                          (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                         ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
            ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                   ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      preshed/maps.cpp:6129:52: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                          (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                         ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
             PyUnicode_WSTR_LENGTH(op)))
             ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      preshed/maps.cpp:6145:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                               ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
            PyUnicode_WSTR_LENGTH(op) :                    \
            ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      preshed/maps.cpp:6145:26: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                               ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
            ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                   ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      preshed/maps.cpp:6145:26: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                               ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
             PyUnicode_WSTR_LENGTH(op)))
             ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      preshed/maps.cpp:6145:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:261:7: note: expanded from macro 'PyUnicode_GET_SIZE'
            PyUnicode_WSTR_LENGTH(op) :                    \
            ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      preshed/maps.cpp:6145:59: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:262:14: note: expanded from macro 'PyUnicode_GET_SIZE'
            ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
                   ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:580:1: note: 'PyUnicode_AsUnicode' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      preshed/maps.cpp:6145:59: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                              (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                                                                ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:264:8: note: expanded from macro 'PyUnicode_GET_SIZE'
             PyUnicode_WSTR_LENGTH(op)))
             ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:451:35: note: expanded from macro 'PyUnicode_WSTR_LENGTH'
      #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
                                        ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/cpython/unicodeobject.h:445:1: note: '_PyUnicode_get_wstr_length' has been explicitly marked deprecated here
      Py_DEPRECATED(3.3)
      ^
      /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      16 warnings and 6 errors generated.
      error: command '/usr/bin/gcc' failed with exit code 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /Users/pietrobon/Downloads/JJ/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-install-o1uwotj4/preshed_3904a612e2894555ad992fe8de7d0ba7/setup.py'"'"'; __file__='"'"'/private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-install-o1uwotj4/preshed_3904a612e2894555ad992fe8de7d0ba7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-record-8l6nqsp5/install-record.txt --single-version-externally-managed --prefix /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-build-env-tdp_0toi/overlay --compile --install-headers /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-build-env-tdp_0toi/overlay/include/site/python3.9/preshed Check the logs for full command output.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/ce/5e/8f21b3f32ea3566764d1c90f4360703be7d1739ed7b51cbf89bed00fa331/spacy-2.1.0.tar.gz#sha256=e3dbde5b560fb9dd3706bd6838e66e28119b6aa17bcb0711d53e95c830bcf0a7 (from https://pypi.org/simple/spacy/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*). Command errored out with exit status 1: /Users/pietrobon/Downloads/JJ/venv/bin/python /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-standalone-pip-7uxqp0sn/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/ng/qbwb1qr92vs2p860gzpg858r0000gn/T/pip-build-env-tdp_0toi/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools 'wheel>0.32.0.<0.33.0' Cython 'cymem>=2.0.2,<2.1.0' 'preshed>=2.0.1,<2.1.0' 'murmurhash>=0.28.0,<1.1.0' thinc==7.0.0.dev6 Check the logs for full command output.
Collecting chatterbot
  Using cached ChatterBot-1.0.4-py2.py3-none-any.whl (66 kB)
Requirement already satisfied: mathparse<0.2,>=0.1 in ./venv/lib/python3.9/site-packages (from chatterbot) (0.1.2)
Requirement already satisfied: sqlalchemy<1.3,>=1.2 in ./venv/lib/python3.9/site-packages (from chatterbot) (1.2.19)
Requirement already satisfied: pymongo<4.0,>=3.3 in ./venv/lib/python3.9/site-packages (from chatterbot) (3.12.0)
Requirement already satisfied: python-dateutil<2.8,>=2.7 in ./venv/lib/python3.9/site-packages (from chatterbot) (2.7.5)
Requirement already satisfied: chatterbot-corpus<1.3,>=1.2 in ./venv/lib/python3.9/site-packages (from chatterbot) (1.2.0)
Requirement already satisfied: nltk<4.0,>=3.2 in ./venv/lib/python3.9/site-packages (from chatterbot) (3.6.2)
Requirement already satisfied: PyYAML<4.0,>=3.12 in ./venv/lib/python3.9/site-packages (from chatterbot-corpus<1.3,>=1.2->chatterbot) (3.13)
Requirement already satisfied: click in ./venv/lib/python3.9/site-packages (from nltk<4.0,>=3.2->chatterbot) (8.0.1)
Requirement already satisfied: joblib in ./venv/lib/python3.9/site-packages (from nltk<4.0,>=3.2->chatterbot) (1.0.1)
Requirement already satisfied: tqdm in ./venv/lib/python3.9/site-packages (from nltk<4.0,>=3.2->chatterbot) (4.61.2)
Requirement already satisfied: regex in ./venv/lib/python3.9/site-packages (from nltk<4.0,>=3.2->chatterbot) (2021.7.6)
Requirement already satisfied: packaging in ./venv/lib/python3.9/site-packages (from pint>=0.8.1->chatterbot) (21.0)
Requirement already satisfied: six>=1.5 in ./venv/lib/python3.9/site-packages (from python-dateutil<2.8,>=2.7->chatterbot) (1.16.0)
Requirement already satisfied: pyparsing>=2.0.2 in ./venv/lib/python3.9/site-packages (from packaging->pint>=0.8.1->chatterbot) (2.4.7)
Installing collected packages: chatterbot
Successfully installed chatterbot-1.0.4

我尝试了以下其他命令

pip3 install chatterbot
pip3 install chatterbot==1.0.4
pip3 install chatterbot==1.0.5
pip3 install chatterbot==1.0.2

但要么他们以同样的方式给了我错误,要么他们告诉我包丢失了,安装后它给了我一个执行错误

无论如何,当我尝试运行脚本时,它会回到我身边

[nltk_data] Error loading averaged_perceptron_tagger: <urlopen error
[nltk_data]     [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
[nltk_data]     failed: unable to get local issuer certificate
[nltk_data]     (_ssl.c:1129)>
[nltk_data] Error loading punkt: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data]     unable to get local issuer certificate (_ssl.c:1129)>
[nltk_data] Error loading stopwords: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data]     unable to get local issuer certificate (_ssl.c:1129)>
List Trainer: [#######             ] 33%[nltk_data] Error loading wordnet: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data]     unable to get local issuer certificate (_ssl.c:1129)>
Traceback (most recent call last):
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/chatterbot/tagging.py", line 63, in tokenize_sentence
    self.sentence_tokenizer = load_data('tokenizers/punkt/{language}.pickle'.format(
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/nltk/data.py", line 750, in load
    opened_resource = _open(resource_url)
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/nltk/data.py", line 875, in _open
    return find(path_, path + [""]).open()
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/nltk/data.py", line 583, in find
    raise LookupError(resource_not_found)
LookupError: 
**********************************************************************
  Resource punkt not found.
  Please use the NLTK Downloader to obtain the resource:

  >>> import nltk
  >>> nltk.download('punkt')
  
  For more information see: https://www.nltk.org/data.html

  Attempted to load tokenizers/punkt/PY3/english.pickle

  Searched in:
    - '/Users/pietrobon/nltk_data'
    - '/Users/pietrobon/Downloads/JJ/venv/nltk_data'
    - '/Users/pietrobon/Downloads/JJ/venv/share/nltk_data'
    - '/Users/pietrobon/Downloads/JJ/venv/lib/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
    - ''
**********************************************************************


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/pietrobon/Downloads/JJ/main.py", line 9, in <module>
    trainer.train([
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/chatterbot/trainers.py", line 103, in train
    statement_search_text = self.chatbot.storage.tagger.get_bigram_pair_string(text)
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/chatterbot/tagging.py", line 135, in get_bigram_pair_string
    for sentence in self.tokenize_sentence(text.strip()):
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/chatterbot/tagging.py", line 68, in tokenize_sentence
    self.sentence_tokenizer = load_data('tokenizers/punkt/{language}.pickle'.format(
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/nltk/data.py", line 750, in load
    opened_resource = _open(resource_url)
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/nltk/data.py", line 875, in _open
    return find(path_, path + [""]).open()
  File "/Users/pietrobon/Downloads/JJ/venv/lib/python3.9/site-packages/nltk/data.py", line 583, in find
    raise LookupError(resource_not_found)
LookupError: 
**********************************************************************
  Resource punkt not found.
  Please use the NLTK Downloader to obtain the resource:

  >>> import nltk
  >>> nltk.download('punkt')
  
  For more information see: https://www.nltk.org/data.html

  Attempted to load tokenizers/punkt/PY3/english.pickle

  Searched in:
    - '/Users/pietrobon/nltk_data'
    - '/Users/pietrobon/Downloads/JJ/venv/nltk_data'
    - '/Users/pietrobon/Downloads/JJ/venv/share/nltk_data'
    - '/Users/pietrobon/Downloads/JJ/venv/lib/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
    - ''
**********************************************************************


Process finished with exit code 1

我该如何解决?是否有更好的库可以开始在 python 中开发“ai”聊天机器人?

标签: pythonpython-3.xbotschatterbot

解决方案


推荐阅读