python2.7和NLTK安装详细教程
程序员文章站
2022-04-16 08:43:45
本文为大家分享了python2.7和nltk安装教程,具体内容如下
系统:windows 7 ultimate 64-bits
python 2.7安装
下载pyth...
本文为大家分享了python2.7和nltk安装教程,具体内容如下
系统:windows 7 ultimate 64-bits
python 2.7安装
下载python 2.7:
安装
nltk安装
1、下载nltk,, 安装。
2、安装时会出现以下错误:python version 2.7 required, which was not found in the registry。
解决办法:
(1)新建一个register.py文件,把以下代码粘贴进去,保存到d盘。
# script to register python 2.0 or later for use with win32all # and other extensions that require python registry settings # # written by joakim loew for secret labs ab / pythonware # # source: # http://www.pythonware.com/products/works/articles/regpy20.htm # # modified by valentine gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html 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!" if __name__ == "__main__": registerpy()
(2)开始-运行-cmd,把d:\register.py复制进去按回车,出现python 2.7 is already registered!则表示配置成功。
3、继续安装setuptools
4、安装pip:开始-运行-d:\program files\python\scripts\easy_install pip
5、安装pyyaml和nltk:开始-运行-d:\program files\python\scripts\pip install pyyaml nltk
6、测试安装:开始-所有程序-python 2.7-idle(python gui),输入import nltk,无错误表示成功。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
上一篇: 2019/1.7 js面向对象笔记
下一篇: 对象导论系列---被隐藏的具体实现
推荐阅读
-
Digital Performer 10音频处理工具详细图文安装教程
-
Win7 32/64位系统下安装SQL2005和SP3补丁安装教程[图文]
-
搜狗浏览器安装网页歪歪插件的详细教程
-
CentOS 6.5 i386 安装MySQL 5.7.18详细教程
-
Maplesoft Maple 2020官方正式版安装教程图文详细介绍(含下载地址)
-
MRTG在windows下面的详细安装步骤教程
-
Accelrys Discovery Studio怎么安装?Discovery Studio2.5安装图文详细教程
-
matlab2014a怎么激活?matlab2014a安装破解激活图文详细教程
-
matlab R2013a怎么激活?matlab 2013a破解安装并激活详细图文教程
-
FotoWorks XL2019怎么破解?FotoWorks XL2019安装破解详细图文教程