Installation of NLTK
Installation of Python 3.7
It is possible that the installation procedure we have chosen may not work with every version of Python. We will assume Python 3.7 here. So, if you have not yet installed Python 3.7 yet, please go ahead and install Python 3.7 now. It is possible that the NLTK wheel may not work with Python 3.6 or Python 3.8 .
Installation from Christoph Gohlke 's web site
To use the website of Christoph Gohlke, JavaScript needs to be activated in the web browser.
- URI of Christoph Gohlke 's wheel page
https://www.lfd.uci.edu/~gohlke/pythonlibs/
The required NLTK wheel »nltk-3.5-py3-none-any.whl« should be downloaded from Christoph Gohlke 's web site to the directory »wheel«.
main.py
import os
import pprint
import subprocess
import sysdef execute( args ):
command = subprocess.list2cmdline( args )
with subprocess.Popen \
( command,
stdout=__import__( 'subprocess' ).PIPE,
stderr=__import__( 'subprocess' ).STDOUT,
bufsize=1, universal_newlines=True ) as p:
for line in p.stdout: print( line, end='' )
print( 'returncode = ', p.returncode )
return p.returncodedef install( wheel ):
execute( [ r"py", r"-3.7", r"-m", r"pip", r"install", wheel ] )def main():
os.chdir( r"wheel" )
install( r"nltk-3.5-py3-none-any.whl" )
Installation without Internet connectivity *
When you want to install without an Internet connection, you can manually copy the five wheels required into the directory »wheel« with an Internet connection and then install without an Internet connection.
- The function »main«
def main():
os.chdir( r"wheel" )
install( r"regex-2020.4.4-cp37-cp37m-win_amd64.whl" )
install( r"tqdm-4.45.0-py3-none-any.whl" )
install( r"joblib-0.14.1-py2.py3-none-any.whl" )
install( r"click-7.1.1-py3-none-any.whl" )
install( r"nltk-3.5-py3-none-any.whl" )
Some error messages, like »Could not fetch URL https://pypi.org/simple/pip/« can then be ignored.
Installation from the official distribution *
The installation of NLTK from the distribution of its creators would require to use an appropriate C compiler during the installation. It is quite possible to choose this option, but it might be easier to install precompiled wheels from Christoph Gohlke.