Reputation: 31
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.
1 I heard pip
is automatically downloaded for versions 3+ but when I type pip install nltk
in command prompt im getting the following error even though i added its path "C:\Users\dheeraj\AppData\Local\Programs\Python\Python36\Scripts\pip36"
in advanced settings and ya in above path i tried pip36 and pip in both cases result is same.
'pip' is not recognized as an internal or external command,"
2 In www.nltk.org I found nltk
for mac, unix and windows32 but not for windows64 ,does that mean it doesnt support for 64bit or is there any way for me to install nltk
.
Upvotes: 3
Views: 21769
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
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
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
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
Reputation: 57
Following are the steps I followed to resolve this issue:
c:\users\grove\appdata\local\programs\python\python36-32\lib\site-packages\pip
Once you're in pip folder type pip install -U nltk
import nltk
Upvotes: 3
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