日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python中nltk_python2.7和NLTK安装详细教程

發布時間:2025/4/5 python 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python中nltk_python2.7和NLTK安装详细教程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文為大家分享了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,無錯誤表示成功。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持我們。

本文標題: python2.7和NLTK安裝詳細教程

本文地址: http://www.cppcns.com/jiaoben/python/240058.html

總結

以上是生活随笔為你收集整理的python中nltk_python2.7和NLTK安装详细教程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。