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如何实现决策树算法
Oct 11 Python
Python中的heapq模块源码详析
Jan 08 Python
Python开发网站目录扫描器的实现
Feb 21 Python
Python实现的读取文件内容并写入其他文件操作示例
Apr 09 Python
python如何读取bin文件并下发串口
Jul 05 Python
python多线程分块读取文件
Aug 29 Python
基于python实现从尾到头打印链表
Nov 02 Python
10个Python面试常问的问题(小结)
Nov 20 Python
python匿名函数lambda原理及实例解析
Feb 07 Python
Python视频编辑库MoviePy的使用
Apr 01 Python
UI自动化定位常用实现方法代码示例
Oct 27 Python
用Python制作音乐海报
Jan 26 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
【星际争霸1】人族1v7家ZBath
2020/03/04 星际争霸
php中get_headers函数的作用及用法的详细介绍
2013/04/27 PHP
PHP 线程安全与非线程安全版本的区别深入解析
2013/08/06 PHP
PHP中file_get_contents函数抓取https地址出错的解决方法(两种方法)
2015/09/22 PHP
php传值方式和ajax的验证功能
2017/03/27 PHP
PHP实现绘制二叉树图形显示功能详解【包括二叉搜索树、平衡树及红黑树】
2017/11/16 PHP
php微信公众号开发之关键词回复
2018/10/20 PHP
索趣科技的答案
2007/02/07 Javascript
JavaScript 设计模式 安全沙箱模式
2010/09/24 Javascript
我的Node.js学习之路(二)NPM模块管理
2014/07/06 Javascript
javascript正则表达式之search()用法实例
2015/01/19 Javascript
jQuery+html5实现div弹出层并遮罩背景
2015/04/15 Javascript
javascript实现实时输出当前的时间
2015/04/27 Javascript
JavaScript的removeChild()函数用法详解
2015/12/27 Javascript
Bootstrap入门书籍之(一)排版
2016/02/17 Javascript
使用JQuery实现智能表单验证功能
2016/03/08 Javascript
JavaScript从数组的indexOf()深入之Object的Property机制
2016/05/11 Javascript
基于JavaScript实现轮播图代码
2016/07/14 Javascript
JavaScript调试的多个必备小Tips
2017/01/15 Javascript
Angular2安装angular-cli
2017/05/21 Javascript
javascript+jQuery实现360开机时间显示效果
2017/11/03 jQuery
Vue通过URL传参如何控制全局console.log的开关详解
2017/12/07 Javascript
微信小程序手机号码验证功能的实例代码
2018/08/28 Javascript
js实现鼠标拖拽div左右滑动
2020/01/15 Javascript
详解Vue中的MVVM原理和实现方法
2020/07/15 Javascript
Python之py2exe打包工具详解
2017/06/14 Python
Python网络编程之TCP套接字简单用法示例
2018/04/09 Python
20行python代码实现人脸识别
2019/05/05 Python
python IDLE添加行号显示教程
2020/04/25 Python
MSC邮轮官方网站:加勒比海、地中海和世界各地的假期
2018/08/27 全球购物
下列程序在32位linux或unix中的结果是什么
2015/01/26 面试题
交通事故委托书范本精选
2014/10/04 职场文书
python 遍历磁盘目录的三种方法
2021/04/02 Python
Axios取消重复请求的方法实例详解
2021/06/15 Javascript
python中%格式表达式实例用法
2021/06/18 Python
SQL SERVER中的流程控制语句
2022/05/25 SQL Server