• NLTK 3.2.2 安装经验


    NLTK 3.2.2 安装经验

    1. Nltk 3.2.2要求Python版本是Python2.7 或者Python3.4+。
    2. Nltk 3.2.3 如果是从网站上直接下载程序进行安装可能会报错:Python version -32 required, which was not found in the registry,

          原因可能有以下几方面:

          1)        Python版本不对:重新安装合适的Python版本

          2)        Python注册信息未加入到注册表中

          3)        Python注册信息不对

          针对后面两种情况,我们可以直接通过脚本register.py(具体代码内容见本文后面)建立注册信息,然后运行该脚本。注册信息添加成功后重新安装nltk模块即可。

    1. Python3.0 以上版本都自带有pip,可以通过pip快捷安装nltk的最新版本,但为了保证库的版本最新,可以先更新pip

          1)        更新pip:py –m pip install –upgrade pip

          2)        安装nltk: py –m pip install nltk

                     当出现打印消息:successfully installed nltk-3.2.2 six-1.10.0时表示安装成功。

    #===========================register.py=======================================##
    #
    !/usr/bin/env python # -*- coding:utf-8 -*- import sys from winreg import * # tweak as necessary version = sys.version[:3] installpath = sys.prefix regpath = "SOFTWARE\Python\Pythoncore\%s\" % (version) installkey = "InstallPath" pythonkey = "PythonPath" pythonpath = "%s;%s\Lib\;%s\DLLs\" % ( installpath, installpath, installpath ) def RegisterPy(): try: reg = OpenKey(HKEY_CURRENT_USER, regpath) except EnvironmentError as e: try: reg = CreateKey(HKEY_CURRENT_USER, regpath) SetValue(reg, installkey, REG_SZ, installpath) SetValue(reg, pythonkey, REG_SZ, pythonpath) CloseKey(reg) except: print ("*** Unable to register!") return print ("--- Python", version, "is 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()

     

  • 相关阅读:
    3709: [PA2014]Bohater
    T89379 【qbxt】复读警告
    T89353 【BIO】RGB三角形
    T89359 扫雷
    P1325 雷达安装
    P2983 [USACO10FEB]购买巧克力
    DP----鬼畜的数字三角形
    提高组突破嘤
    数据结构题目大赏 (一堆题目没做)
    DAY 3
  • 原文地址:https://www.cnblogs.com/no-tears-girl/p/6382227.html
Copyright © 2020-2023  润新知