香港黑夜,哮喘食疗,云浮一中女生
本文为大家分享了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,无错误表示成功。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
python求numpy中array按列非零元素的平均值案例
网友评论