Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (16.4k points)

I attempted to install the nltk on the terminal I have python2.7 and I also installed python3.8 and java8 yet I got plenty of errors

Last login: Wed Sep 30 22:02:28 on console

hanadyahmed@hanadys-mbp-2 ~ % python -V

Python 2.7.16

hanadyahmed@hanadys-mbp-2 ~ % sudo apt update

Password:

Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home/bin/apt" (-1)

hanadyahmed@hanadys-mbp-2 ~ % python3

Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) 

[Clang 6.0 (clang-600.0.57)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import nltk

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

ModuleNotFoundError: No module named 'nltk'

>>> 

zsh: suspended  python3

hanadyahmed@hanadys-mbp-2 ~ % cd Desktop\python_Exercises

cd: no such file or directory: Desktoppython_Exercises

hanadyahmed@hanadys-mbp-2 ~ % cd Desktop/python_Exercises

cd: no such file or directory: Desktop/python_Exercises

hanadyahmed@hanadys-mbp-2 ~ % import sys

zsh: command not found: import

hanadyahmed@hanadys-mbp-2 ~ % pyhton3.8

zsh: command not found: pyhton3.8

hanadyahmed@hanadys-mbp-2 ~ % python3

Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) 

[Clang 6.0 (clang-600.0.57)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> 

zsh: suspended  python3

hanadyahmed@hanadys-mbp-2 ~ % python --version

Python 2.7.16

hanadyahmed@hanadys-mbp-2 ~ % pip --version

pip 20.2.3 from /Library/Python/2.7/site-packages/pip-20.2.3-py2.7.egg/pip (python 2.7)

hanadyahmed@hanadys-mbp-2 ~ % python get-pip.py

/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'get-pip.py': [Errno 2] No such file or directory

hanadyahmed@hanadys-mbp-2 ~ % sudo apt install python3.8-pip

Password:

Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home/bin/apt" (-1)

hanadyahmed@hanadys-mbp-2 ~ % 

1 Answer

0 votes
by (26.4k points)

Have you tried the following code?

import nltk

nltk.download()

This ought to raise a window to choose what you need to download from nltk

Want to learn python to get expertise in the concepts of python? Join python certification course and get certified

For more details, do check out the below video tutorial...

Related questions

0 votes
4 answers
0 votes
4 answers
0 votes
1 answer
asked Nov 27, 2020 in Python by bharathbk (280 points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...