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私有属性和方法实例分析
Jan 15 Python
Python变量作用范围实例分析
Jul 07 Python
Python3字符串学习教程
Aug 20 Python
Python随手笔记之标准类型内建函数
Dec 02 Python
flask中过滤器的使用详解
Aug 01 Python
Pandas读写CSV文件的方法示例
Mar 27 Python
Python生成一个迭代器的实操方法
Jun 18 Python
使用python进行广告点击率的预测的实现
Jul 04 Python
django实现将修改好的新模型写入数据库
Mar 31 Python
什么是Python变量作用域
Jun 03 Python
python简单实现插入排序实例代码
Dec 16 Python
python 判断文件或文件夹是否存在
Mar 18 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
域名查询代码公布
2006/10/09 PHP
PHP积分兑换接口实例
2015/02/09 PHP
php使用cookie实现记住用户名和密码实现代码
2015/04/27 PHP
开启PHP Static 关键字之旅模式
2015/11/13 PHP
PHP仿微信多图片预览上传实例代码
2016/09/13 PHP
jquery下异步提交表单 异步跨域提交表单
2010/11/17 Javascript
JS获取url链接字符串 location.href
2013/12/23 Javascript
javascript实现单击和双击并存的方法
2014/12/13 Javascript
js获取form的方法
2015/05/06 Javascript
JavaScript快速切换繁体中文和简体中文的方法及网站支持简繁体切换的绝招
2016/03/07 Javascript
JavaScript易错知识点整理
2016/12/05 Javascript
JS实现动态添加DOM节点和事件的方法示例
2017/04/28 Javascript
ES6数组与对象的解构赋值详解
2019/06/14 Javascript
JavaScript 继承 封装 多态实现及原理详解
2019/07/29 Javascript
[05:02][DOTA2]DOTA进化论 第一期
2013/09/27 DOTA
[01:39](回顾)各路豪强针锋相对,几经鏖战四强产生
2014/07/01 DOTA
[56:38]DOTA2-DPC中国联赛正赛Aster vs Magma BO3 第一场 3月5日
2021/03/11 DOTA
python脚本内运行linux命令的方法
2015/07/02 Python
在python中将字符串转为json对象并取值的方法
2018/12/31 Python
用Python解决x的n次方问题
2019/02/08 Python
django admin组件使用方法详解
2019/07/19 Python
Python无头爬虫下载文件的实现
2020/04/02 Python
flask开启多线程的具体方法
2020/08/02 Python
python openCV实现摄像头获取人脸图片
2020/08/20 Python
Django通过设置CORS解决跨域问题
2020/11/26 Python
美国山地自行车、露营、户外装备和服装购物网站:Aventuron
2018/05/05 全球购物
飞利浦法国官网:Philips法国
2019/07/10 全球购物
波兰最早的运动鞋精品店之一:Street Supply
2019/08/29 全球购物
农行实习自我鉴定
2013/09/22 职场文书
一年级班主任感言
2014/03/08 职场文书
优秀食品类广告词
2014/03/19 职场文书
焦裕禄精神心得体会
2014/09/02 职场文书
四风对照检查材料范文
2014/09/27 职场文书
战马观后感
2015/06/08 职场文书
幼儿教师远程研修感悟
2015/11/18 职场文书
pytorch 如何把图像数据集进行划分成train,test和val
2021/05/31 Python