Python 3.x jupyterhub-NLTK-无法使用停止字

Python 3.x jupyterhub-NLTK-无法使用停止字,python-3.x,jupyter-notebook,nltk,stop-words,jupyterhub,Python 3.x,Jupyter Notebook,Nltk,Stop Words,Jupyterhub,我使用下面的代码通过jupyter笔记本使用stopwords。我在Linux服务器上托管了jupyter,并使用了笔记本电脑 python3 -m nltk.downloader stopwords python3 -m nltk.downloader words python3 -m nltk.downloader punkt python3 >>>from nltk.corpus import stopwords >>>stop_words = set

我使用下面的代码通过jupyter笔记本使用stopwords。我在Linux服务器上托管了jupyter,并使用了笔记本电脑

python3 -m nltk.downloader stopwords
python3 -m nltk.downloader words
python3 -m nltk.downloader punkt

python3
>>>from nltk.corpus import stopwords
>>>stop_words = set(stopwords.words("english"))
>>>print(stop_words)
这在python终端中运行时效果很好,但当我在下面的Jupyternotebook中尝试时,它失败了,出现了错误

from nltk.corpus import stopwords
stop_words = set(stopwords.words("english"))
print(stop_words)

---------------------------------------------------------------------------
LookupError                               Traceback (most recent call last)
/usr/local/lib/python3.7/site-packages/nltk/corpus/util.py in __load(self)
     82                 try:
---> 83                     root = nltk.data.find("{}/{}".format(self.subdir, zip_name))
     84                 except LookupError:

/usr/local/lib/python3.7/site-packages/nltk/data.py in find(resource_name, paths)
    582     resource_not_found = "\n%s\n%s\n%s\n" % (sep, msg, sep)
--> 583     raise LookupError(resource_not_found)
    584 

LookupError: 
**********************************************************************
  Resource stopwords not found.
  Please use the NLTK Downloader to obtain the resource:
当我尝试下载python3终端时,我看到它已经是最新的了

>>> import nltk >>> nltk.download('stopwords') [nltk_data] Downloading package stopwords to /root/nltk_data... [nltk_data]   Package stopwords is already up-to-date!

但当通过jupyter hub进行尝试时,下载超时。理想情况下,如果它是最新的,则不需要下载。jupyter hub中是否有处理此问题的配置

我能够修复此问题。我以root用户身份下载了
nltk包。但在Jupyter hub中,我作为用户使用。
以用户身份从服务器上的python3终端下载了该包,并能够修复此问题

谢谢