小编Yes*_*nth的帖子

如何解决导入 nltk 包时出现以下错误

错误的屏幕截图

使用 pip3 install nltk 安装 nltk 后

我无法在 macOS 的 python shell 中导入 nltk


  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nltk/__init__.py", line 137, in <module>

    from nltk.text import *
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nltk/text.py", line 29, in <module>

    from nltk.tokenize import sent_tokenize
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nltk/tokenize/__init__.py", line 65, in <module>

    from nltk.tokenize.casual import TweetTokenizer, casual_tokenize
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nltk/tokenize/casual.py", line 49, in <module>

    import regex  # https://github.com/nltk/nltk/issues/2409
  File "/Users/userId/Library/Python/3.9/lib/python/site-packages/regex/__init__.py", line 1, in <module>

    from .regex import *
  File "/Users/userId/Library/Python/3.9/lib/python/site-packages/regex/regex.py", line 419, in <module>

    import regex._regex_core …
Run Code Online (Sandbox Code Playgroud)

python nltk

5
推荐指数
1
解决办法
1052
查看次数

标签 统计

nltk ×1

python ×1