国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

win10 64bit下python NLTK安裝教程

2020-02-15 23:00:35
字體:
供稿:網(wǎng)友

由于最近需要做項目,需要進行分詞等,查了資料之后,發(fā)現(xiàn)python NLTK很強大,于是就想試試看。在網(wǎng)上找了很多安裝資料,都不太完整,下載的時候也總是會出現(xiàn)一點小意外,最后終于也安裝成功了,所以分享下經(jīng)驗。

初學者,請高手指出不合理的地方。

我的工作站環(huán)境是Win10 64 + Python 2.7.12 64 bit。

按照NLTK上安裝主頁上的指引如下:

Source installation (for 32-bit or 64-bit Windows) 1.Install Python: http://www.python.org/download/releases/2.7.3/2.Install Numpy (optional): http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy3.Install Setuptools: http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe4.Install Pip: Start>Run... c:/Python27/Scripts/easy_install pip5.Install PyYAML and NLTK: Start>Run... c:/Python27/Scripts/pip install pyyaml nltk6.Test installation: Start>All Programs>Python27>IDLE, then type import nltk

前3步的安裝都比較簡單,如果為了更好的編輯,也可以安裝一下編輯軟件,如PyCharm,Sublime text2/3等等。在安裝的時候要注意安裝路徑,最好不要出現(xiàn)中文。

我在安裝第4步的時候出現(xiàn)了一點小問題,執(zhí)行命令后報錯:Python version 2.7 required, which was not found in the registry,于是我又到網(wǎng)上查了資料,解決方法是:

1)自己新建一個register.py文件,在文件中復制黏貼以下內(nèi)容,然后保存到自己的路徑,我是直接放到pyhon的安裝文件夾中;

# # 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()             
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 塘沽区| 黎平县| 突泉县| 沧州市| 蓬莱市| 宁安市| 阿拉尔市| 美姑县| 百色市| 恩施市| 太白县| 禄丰县| 新龙县| 民丰县| 勃利县| 肃北| 丰镇市| 泽库县| 永州市| 仙游县| 北川| 文山县| 蒙城县| 石渠县| 定西市| 黄骅市| 河西区| 洛南县| 昌江| 罗甸县| 南部县| 贵阳市| 望谟县| 乌拉特中旗| 绥化市| 江达县| 连江县| 彰武县| 桐庐县| 高安市| 胶州市|