NLTK3.2.4环境搭建教程-创新互联

本文记录了NLTK 3.2.4 环境搭建的方法,供大家参考,具体内容如下

创新互联公司从2013年开始,是专业互联网技术服务公司,拥有项目网站设计制作、成都网站设计网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元颍州做网站,已为上家服务,为颍州各地企业和个人服务,联系电话:028-86922220

系统环境:win7 32位

python:2.7.13,后改为3.6.1

安装NLTK

从网站下载,完成后双击安装,但提示Python version -32 required, which was not found in the registry.

从网上搜索到以下解决方案:

新建文件D:\register.py,通过脚本建立注册信息

#===============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()

当前名称:NLTK3.2.4环境搭建教程-创新互联
当前地址:http://scyanting.com/article/hseod.html