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进阶_浅谈面向对象进阶
Aug 17 Python
Python 私有函数的实例详解
Sep 11 Python
python Celery定时任务的示例
Mar 13 Python
Python利用正则表达式实现计算器算法思路解析
Apr 25 Python
Python3多线程操作简单示例
May 22 Python
浅析python的优势和不足之处
Nov 20 Python
在python中获取div的文本内容并和想定结果进行对比详解
Jan 02 Python
python查找重复图片并删除(图片去重)
Jul 16 Python
python3.7环境下安装Anaconda的教程图解
Sep 10 Python
浅谈python量化 双均线策略(金叉死叉)
Jun 03 Python
scrapy-redis分布式爬虫的搭建过程(理论篇)
Sep 29 Python
python实现scrapy爬虫每天定时抓取数据的示例代码
Jan 27 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设计模式 Observer(观察者模式)
2011/06/26 PHP
注册页面之前先验证用户名是否存在的php代码
2012/07/14 PHP
基于python发送邮件的乱码问题的解决办法
2013/04/25 PHP
Smarty模板学习笔记之Smarty简介
2014/05/20 PHP
php+html5基于websocket实现聊天室的方法
2015/07/17 PHP
PHPStrom中实用的功能和快捷键大全
2015/09/23 PHP
Zend Framework教程之视图组件Zend_View用法详解
2016/03/05 PHP
PHP将页面中点击数量高的链接进行高亮显示的方法
2016/05/30 PHP
简单谈谈PHP中的Reload操作
2016/12/12 PHP
IE Firefox 使用自定义标签的区别
2009/10/15 Javascript
JQuery动态给table添加、删除行 改进版
2011/01/19 Javascript
文档对象模型DOM通俗讲解
2013/11/01 Javascript
父页面显示遮罩层弹出半透明状态的dialog
2014/03/04 Javascript
jquery中filter方法用法实例分析
2015/02/06 Javascript
JS拖拽组件学习使用
2016/01/19 Javascript
分享一个原生的JavaScript拖动方法
2016/09/25 Javascript
老生常谈combobox和combotree模糊查询
2017/04/17 Javascript
学习使用Bootstrap栅格系统
2017/05/11 Javascript
VUE元素的隐藏和显示(v-show指令)
2017/06/23 Javascript
React Native react-navigation 导航使用详解
2017/12/01 Javascript
JavaScript闭包与作用域链实例分析
2019/01/21 Javascript
JavaScript中的ES6 Proxy的具体使用
2019/06/16 Javascript
vue自定义组件实现双向绑定
2021/01/13 Vue.js
vue动态设置路由权限的主要思路
2021/01/13 Vue.js
[03:16]DOTA2完美大师赛小组赛精彩集锦
2017/11/22 DOTA
PyCharm无法引用自身项目解决方式
2020/02/12 Python
python 瀑布线指标编写实例
2020/06/03 Python
如何用python免费看美剧
2020/08/11 Python
python 如何使用find和find_all爬虫、找文本的实现
2020/10/16 Python
Html5应用程序缓存(Cache manifest)
2018/06/04 HTML / CSS
改变生活的男士内衣:SAXX Underwear
2019/08/28 全球购物
激励口号大全
2014/06/17 职场文书
四风问题个人剖析材料
2014/10/07 职场文书
2015高三毕业寄语赠言
2015/02/27 职场文书
督导岗位职责范本
2015/04/10 职场文书
CSS 一行代码实现头像与国旗的融合
2021/10/24 HTML / CSS