NLTK 3.2.4 环境搭建教程
作者:fessigy 时间:2023-09-14 03:47:27
本文记录了NLTK 3.2.4 环境搭建的方法,供大家参考,具体内容如下
系统环境:win7 32位
python:2.7.13,后改为3.6.1
安装NLTK
从网站下载,完成后双击安装,但提示Python version -32 required, which was not found in the registry.
从网上搜索到以下解决方案:
新建文件D:\register.py,通过脚本建立注册信息
#===============register.py====================##
#!/usr/bin/env python
# -*- coding:utf-8 -*-
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!")
RegisterPy()
打开cmd,执行
运行安装文件,仍然失败= =(有大神能解决的请私信或留言 谢谢!)
于是放弃了中文版的NLP with Python,重投http://www.nltk.org/book/。
安装最新版python3.6.1,cmd中直接执行
py –m pip install nltk
安装成功。
在IDLE中输入命令
>>>import nltk
>>>nltk.download()
终于出现如下NLTK Downloader界面
下载完毕后,就可以在IDLE中加载NLTK并使用了。
>>>from nltk.book import *
来源:https://blog.csdn.net/fessigy/article/details/72923382
标签:NLTK3.2,NLTK3.2.4
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
JS通过分析userAgent属性来判断浏览器的类型及版本
2024-05-13 10:37:17
Tensorflow加载预训练模型和保存模型的实例
2022-06-03 05:55:41
Python之pandas读写文件乱码的解决方法
2021-03-18 20:25:35
浅谈Golang内存逃逸
2023-08-27 07:51:55
python优雅实现代码与敏感信息分离的方法
2022-05-07 18:21:14
Python实现批量梯度下降法(BGD)拟合曲线
2023-03-31 07:18:03
![](https://img.aspxhome.com/file/2023/0/117350_0s.jpg)
Apache部署Django项目图文详解
2023-12-17 06:51:05
![](https://img.aspxhome.com/file/2023/2/134802_0s.png)
pytorch如何定义新的自动求导函数
2021-02-10 20:14:49
![](https://img.aspxhome.com/file/2023/6/81676_0s.jpg)
python抽取指定url页面的title方法
2022-11-15 21:52:40
mysql数据库查询基础命令详解
2024-01-19 21:19:21
python2和python3在处理字符串上的区别详解
2021-10-07 03:29:31
在Mac上删除自己安装的Python方法
2021-03-22 22:10:57
正视WEB标准,一本全面的标准参考书
2009-05-30 16:36:00
![](https://img.aspxhome.com/file/UploadPic/20095/30/s3396721-91s.jpg)
如何用表单在线建立目录?
2010-06-16 09:49:00
python里运用私有属性和方法总结
2023-03-29 15:33:57
![](https://img.aspxhome.com/file/2023/0/69050_0s.png)
mysql时间戳转成常用可读时间格式的两种方法
2024-01-18 09:38:24
php入门学习知识点三 PHP上传
2023-11-23 12:10:49
Ubuntu配置Pytorch on Graph (PoG)环境过程图解
2022-01-13 02:05:12
![](https://img.aspxhome.com/file/2023/6/108056_0s.png)
Windows 64位下python3安装nltk模块
2023-11-20 09:42:12
![](https://img.aspxhome.com/file/2023/5/68275_0s.jpg)
深入浅出SQL嵌套SELECT语句
2009-02-06 14:25:00