ModuleNotFoundError: No module named ‘nltk‘的解决方法

近期在跑模型代码的时候,出现报错:

ModuleNotFoundError: No module named ‘nltk‘的解决方法_第1张图片

网上有很多方式,但是过程复杂,经过尝试,用下面的方法解决了:

pip install -U nltk

然后提示安装成功!

Collecting nltk
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/43/0b/8298798bc5a9a007b7cae3f846a3d9a325953e0f9c238affa478b4d59324/nltk-3.7-py3-none-any.whl (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 3.0 MB/s eta 0:00:00
Requirement already satisfied: joblib in /home/hao/anaconda3/envs/wh_cuda11.6/lib/python3.9/site-packages (from nltk) (1.1.0)
Requirement already satisfied: regex>=2021.8.3 in /home/hao/anaconda3/envs/wh_cuda11.6/lib/python3.9/site-packages (from nltk) (2022.9.13)
Requirement already satisfied: tqdm in /home/hao/anaconda3/envs/wh_cuda11.6/lib/python3.9/site-packages (from nltk) (4.64.0)
Requirement already satisfied: click in /home/hao/anaconda3/envs/wh_cuda11.6/lib/python3.9/site-packages (from nltk) (8.1.3)
Installing collected packages: nltk
Successfully installed nltk-3.7

你可能感兴趣的:(error解决,linux,python,运维)