NLTK Installation Tips

Source: Internet
Author: User
Tags nltk

1. Can go directly to the official website NLTK:HTTPS://PYPI.PYTHON.ORG/PYPI/NLTK download installation package directly to install the configuration

2.NLTK 3.2.2 Required version is Python 2.7 or 3.4+

There may be an error when installing directly using the installation package on the official website, for example, I encountered Python-32 was Required,which is not found in registry.

Possible causes:

1.Python version not correct

2. Incorrect registry information, Python not joined the registry

To resolve this situation, you can use the Create script file to establish the registration information. (The code is appended to the end of the article), and then run the script, and then run the installation after it has been successfully added.


PS: You can also use the PIP for a quick installation.

Python3.0 with the pip above, to keep the library up to date, you can update the PIP before you install NLTK.

Update pip:python-m PIP install-u pip

Install nltk:python-m pip Install NLTK



After a successful installation, you can install the data directly.




#===========================register.py=======================================## #!/usr/bin/env Python #-*-coding : utf-8-*-Import sys from winreg import * # tweak as necessary version = Sys.version[:3] InstallPath = Sys.prefix Regpa th = "software\\python\\pythoncore\\%s\\"% (version) Installkey = "InstallPath" Pythonkey = "Pythonpath" Pythonpath = "%s" ;%s\\lib\\;%s\\dlls\\ "% (InstallPath, InstallPath, InstallPath) def registerpy (): Try:reg = Open Key (HKEY_CURRENT_USER, Regpath) except environmenterror as E:try:reg = CreateKey (hkey_current_us ER, Regpath) SetValue (Reg, Installkey, REG_SZ, InstallPath) SetValue (Reg, Pythonkey, REG_SZ, Pytho
            Npath) Closekey (reg) Except:print ("* * Unable to register!")
        return print ("---Python", version, "are now registered!") return if (QueryValue (Reg, installkey) = = InstallPath and QueryValue (Reg, PythonkEY) = = Pythonpath): Closekey (reg) print ("= = = Python", version, "is already registered!")
    Return Closekey (reg) Print ("* * Unable to register!")

Print ("* * * you probably have another Python installation!") Registerpy ()


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.