python2.7和NLTK安装详细教程


Posted in Python onSeptember 19, 2018

本文为大家分享了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 相关文章推荐
Python使用Flask框架获取当前查询参数的方法
Mar 21 Python
Python对List中的元素排序的方法
Apr 01 Python
对python list 遍历删除的正确方法详解
Jun 29 Python
详解django.contirb.auth-认证
Jul 16 Python
Python列表推导式与生成器用法分析
Aug 02 Python
python绘制热力图heatmap
Mar 23 Python
python的pytest框架之命令行参数详解(下)
Jun 27 Python
简单了解python变量的作用域
Jul 30 Python
Pycharm连接远程服务器并实现远程调试的实现
Aug 02 Python
Python Subprocess模块原理及实例
Aug 26 Python
Selenium向iframe富文本框输入内容过程图解
Apr 10 Python
python3中celery异步框架简单使用+守护进程方式启动
Jan 20 Python
python排序函数sort()与sorted()的区别
Sep 18 #Python
idea创建springMVC框架和配置小文件的教程图解
Sep 18 #Python
如何安装多版本python python2和python3共存以及pip共存
Sep 18 #Python
python2与python3共存问题的解决方法
Sep 18 #Python
Win10下python3.5和python2.7环境变量配置教程
Sep 18 #Python
Python global全局变量函数详解
Sep 18 #Python
Win10下python 2.7.13 安装配置方法图文教程
Sep 18 #Python
You might like
PHP 正则表达式常用函数
2014/08/17 PHP
简述php环境搭建与配置
2016/12/05 PHP
浅谈PHP中new self()和new static()的区别
2017/08/11 PHP
详解php与ethereum客户端交互
2018/04/28 PHP
js prototype截取字符串函数
2010/04/01 Javascript
js中的scroll和offset 使用比较的实例与分析
2013/09/29 Javascript
点击按钮或链接不跳转只刷新页面的脚本整理
2013/10/22 Javascript
Jquery跳到页面指定位置的方法
2014/05/12 Javascript
推荐9款炫酷的基于jquery的页面特效
2014/12/07 Javascript
Bootstrap基本组件学习笔记之按钮组(8)
2016/12/07 Javascript
JS返回只包含数字类型的数组实例分析
2016/12/16 Javascript
js如何获取网页所有图片
2017/05/12 Javascript
解决在vue+webpack开发中出现两个或多个菜单公用一个组件问题
2017/11/28 Javascript
浅谈webpack4 图片处理汇总
2018/09/12 Javascript
vuex存取值和映射函数使用说明
2020/07/24 Javascript
[54:58]完美世界DOTA2联赛PWL S2 LBZS vs Rebirth 第一场 11.25
2020/11/25 DOTA
[06:59]DOTA2-DPC中国联赛3月7日Recap集锦
2021/03/11 DOTA
详解Python中的type()方法的使用
2015/05/21 Python
Django学习教程之静态文件的调用详解
2018/05/08 Python
Python应用库大全总结
2018/05/30 Python
python实现机器学习之多元线性回归
2018/09/06 Python
Linux下安装python3.6和第三方库的教程详解
2018/11/09 Python
python 魔法函数实例及解析
2019/09/25 Python
英国、欧洲和全球租车服务:Avis英国
2016/08/29 全球购物
英国PC组件和在线电脑商店:SCAN
2019/04/18 全球购物
Java基础面试题
2014/07/19 面试题
大学同学聚会邀请函
2014/01/19 职场文书
班主任个人工作反思
2014/04/28 职场文书
团支部建设方案
2014/05/02 职场文书
政风行风评议整改方案
2014/09/15 职场文书
2014年医院十一国庆节活动方案
2014/09/15 职场文书
查摆问题整改措施范文
2014/10/11 职场文书
搞笑的婚礼主持词
2015/06/29 职场文书
董事长致辞
2015/07/29 职场文书
分享:关于学习的励志名言赏析
2019/08/16 职场文书
css如何把元素固定在容器底部的四种方式
2022/06/16 HTML / CSS