dheeraj
dheeraj

Reputation: 31

nltk for python 3.6 in windows64

I'm new to python, I'm using Windows 10 and have python36 and I basically have to use nltk for my project and i basically have two questions.

Upvotes: 3

Views: 21769

Answers (6)

Ujjwal Raj Shah
Ujjwal Raj Shah

Reputation: 1

First install the module like pip install -U nltk and the use the import statment in the command prompt or IDLE

import nltk

Upvotes: 0

Pavan Kulkarni
Pavan Kulkarni

Reputation: 31

Directly Search for pip folder and navigate throught that path example: C:\Users\PAVAN\Environments\my_env\Lib\site-packages\pip> Run cmd and then run the command pip install -U nltk

Upvotes: 3

Edward Weinert
Edward Weinert

Reputation: 543

I will recommend you to use the Anaconda on Windows. Anaconda has nltk version for Python 64-bit. Now I'm using Python 3.6.4 64-bit and nltk.

Under python shell run:

import nltk nltk.download()

then the downloader will be open in new window and you can download what you want.

Upvotes: 1

said badar
said badar

Reputation: 51

I had the same problem as you, but I accidentally found pip.exe in my python directory, so I navigated to said directory with CMD and ran the command pip install -U nltk and it worked.

Upvotes: 5

Pallavi Grover
Pallavi Grover

Reputation: 57

Following are the steps I followed to resolve this issue:

  1. Click on Python 3.6 Module Docs (32 bit). This will open in your default browser.
  2. Click on pip(Package), displayed at the end of the page.
  3. You will be redirected to a page displaying details of the package. Find the exact path from there. It will be something like c:\users\grove\appdata\local\programs\python\python36-32\lib\site-packages\pip
  4. Run this on cmd prompt. enter image description here

  5. Once you're in pip folder type pip install -U nltk

  6. Go back to Python Shell and type import nltk

Upvotes: 3

Yacine Bensaoucha
Yacine Bensaoucha

Reputation: 31

Run the Python interpreter and type the commands:

import nltk>>> nltk.download()>>> A new window should open, showing the NLTK Downloader. Click on the File menu and select Change Download Directory. For central installation, set this to C:\nltk_data (Windows), /usr/local/share/nltk_data(Mac), or /usr/share/nltk_data (Unix). Next, select the packages or collections you want to download.

If you did not install the data to one of the above central locations, you will need to set the NLTK_DATA environment variable to specify the location of the data. (On a Windows machine, right click on “My Computer” then select Properties > Advanced > Environment Variables > User Variables > New...)

Test that the data has been installed as follows. (This assumes you downloaded the Brown Corpus):

from nltk.corpus import brown>>> brown.words()>>> ['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', ...] Installing via a proxy web server

If your web connection uses a proxy server, you should specify the proxy address as follows. In the case of an authenticating proxy, specify a username and password. If the proxy is set to None then this function will attempt to detect the system proxy.

nltk.set_proxy('http://proxy.example.com:3128', ('USERNAME', 'PASSWORD'))>>> >>> nltk.download() Command line installation

The downloader will search for an existing nltk_data directory to install NLTK data. If one does not exist it will attempt to create one in a central location (when using an administrator account) or otherwise in the user’s filespace. If necessary, run the download command from an administrator account, or using sudo. The recommended system location is C:\nltk_data (Windows); /usr/local/share/nltk_data (Mac); and/usr/share/nltk_data `(Unix). You can use the -d flag to specify a different location (but if you do this, be sure to set the NLTK_DATA environment variable accordingly).

Run the command python -m nltk.downloader all. To ensure central installation, run the command sudo python -m nltk.downloader -d /usr/local/share/nltk_data all.

Windows: Use the “Run...” option on the Start menu. Windows Vista users need to first turn on this option, using Start -> Properties -> Customize to check the box to activate the “Run...” option.

Upvotes: 3

Related Questions