简体   繁体   English

在python中查找NLTK模块

[英]Finding NLTK module in python

I'm trying to use the NLTK module in IDLE but it can't find the module—I noticed NLTK had downloaded to my system's default python directory for the 2.7 version, so I found the file path to the "site-packages" folder in 3.8 and copied NLTK there, but now when I try to "import NLTK" in python I get this error message:我正在尝试在 IDLE 中使用 NLTK 模块,但它找不到该模块——我注意到 NLTK 已下载到我系统的 2.7 版本的默认 python 目录,所以我找到了“site-packages”文件夹的文件路径在 3.8 中并在那里复制 NLTK,但是现在当我尝试在 python 中“导入 NLTK”时,我收到此错误消息:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import nltk
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/nltk/__init__.py", line 99, in <module>
    from nltk.internals import config_java
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/nltk/internals.py", line 28, in <module>
    from six import string_types
ModuleNotFoundError: No module named 'six'

As I understand your intention is to use the NLTK package that you have installed for Python 2.7 , in Python 3.8, correct ?据我了解,您的意图是在 Python 3.8 中使用您为 Python 2.7 安装的 NLTK 包,对吗?
In such case you shouldn't copy the library yourself, but rather use pip3 to install it once again into P3.8.在这种情况下,您不应自己复制库,而应使用 pip3 将其再次安装到 P3.8 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM