python3 安装pyhanlp方法
直接pip install pyhanlp的时候会提示缺少Microsoft Visual c++环境,
其实没有Microsoft Visual c++环境也是可以的,
可以先安装jpype1,然后在pip install pyhanlp就行了。
步骤:
①在python非官方库网站上下载库jpyre1的whl文件,
文件链接https://www.lfd.uci.edu/~gohlke/pythonlibs/#jpype
下载后在命令提示符里切换到下载的路径下,执行pip install JPype1-0.6.3-cp36-cp36m-win_amd64.whl就安装上了。
②执行pip install pyhanlp,就能安装了。
安装完成后并不能使用,需要下载一个jar包、data文件和properties文件,因为hanlp是java开发的虽然有python的API但是还是需要java环境,所以需要安装JDK。
在命令行里输hanlp或者在python提示符下输import pyhanlp,它会自动下载jar包、data文件和properties文件到默认的目录,data文件比较大1个G左右,下载完成后命令提示符中输入hanlp,如果已经安装了JDK扔出现下面错误
File "d:\program files (x86)\python3\setup\lib\site-packages\jpype\_jvmfinder.py", line 153, in get_jvm_path
.format(self._libfile))
jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.
则需要添加一个JAVA_HOME变量,变量值为java的bin目录的绝对路径。
然后重新打开命令提示符(更改环境变量后需要重新打开命令提示符才能加载出更改后的变量 !),再输入hanlp就能看到使用方法了。
hanlp、pyhanlp的具体使用方法见:
https://go.ctolib.com/hankcs-pyhanlp.html
http://www.hankcs.com/nlp/hanlp.html
https://github.com/hankcs/HanLP/blob/master/README.md
python3 安装pyhanlp方法的更多相关文章
- PyCrpyto windows安装使用方法
PyCrypto - The Python Cryptography Toolkit PyCrypto是一个免费的加密算法库,支持常见的DES.AES加密以及MD5.SHA各种HASH运算. ---- ...
- mac python3安装virtualenv出现的问题
pip3 install virtualenv pip3 install virtualenvwrapper 安装成功后可能 找不到该命令, 解决办法 1.在 vim ~/.bashrc export ...
- Python3安装turtle提示错误:Command "python setup.py egg_info" failed with error code 1
Python3安装turtle提示错误:Command "python setup.py egg_info" failed with error code 1 Python3.5安 ...
- Python3安装(二)
因为Python是跨平台的,它可以运行在Windows.Mac和各种Linux/Unix系统上.在Windows上写Python程序,放到Linux上也是能够运行的. 要开始学习Python编程,首先 ...
- Python3安装与使用urllib2包之小坑
Python3 安装urllib2包之小坑 Python3.6.6或者说python3.x找不到urllib2语法问题修改之后,会报一个没有安装urllib2的包的错误. 通过pip install ...
- python3 安装pip提示没有distutils.util模块错误的解决
Python3 安装pip 提示ModuleNotFoundError: No module named 'distutils.util' 环境ubutun14,python版本是python3. ...
- python3安装模块,摘自网上
配置好Python3.6和pip3安装EPEL和IUS软件源 yum install epel-release -y yum install https://centos7.iuscommunity. ...
- 安装pyhanlp
安装pyhanlp pyhanlp是java写的,外层封装了python. 对于新手,在使用的时候稍有难度. 1. 下载源码 https://github.com/hankcs/pyhanlp git ...
- python3安装,支持openssl,支持采集https
python3安装,支持openssl,支持采集https 坑好多,特别是安装的时候,各种不匹配,服务器默认配置是python2,升级3后,采集的时候用到openssl,花了两天也没搞定各种错误,也许 ...
随机推荐
- CSS/LESS tips and snippets
如何style line-through? <style type="text/css"> span.inner { color: green; } span.oute ...
- What’s the difference between a stack and a heap?
http://www.programmerinterview.com/index.php/data-structures/difference-between-stack-and-heap/ The ...
- IOS生成同时支持armv7,armv7s,i386的静态库.a文件
许多第三方提供的.a文件(一般是那些SDK),嵌入到我们的xcode项目后,生成不会报错. 一部分粗心的SDK提供方,或者我们自己做的.a文件,就会有报错,常见的就是不是armv7结构,或者不是arm ...
- C++实现线性表的顺序存储结构
将线性表的抽象数据类型定义在顺序表存储结构下用C++的类实现,由于线性表的数据元素类型不确定,所以采用模板机制. 头文件seqlist.h #pragma once #include <iost ...
- Disruptor
高性能队列Disruptor系列2--浅析Disruptor 目录 1. Disruptor简单介绍2. 为什么Disruptor如此之快3. Disruptor结构分析 1. Disruptor ...
- Android(java)学习笔记210:Android线程形态之 IntentService
1. IntentService原理 IntentService是一种特殊的Service,既然是Service,使用的时候记得在AndroidManifest清单文件中注册. 并且它是一个抽象类,因 ...
- checkbox的readonly属性设置
方式一: checkbox没有readOnly属性,如果使用disabled=“disabled”属性的话,会让checkbox变成灰色的,用户很反感这种样式可以这样让它保持只读: 设置它的oncli ...
- T-sql中的三种分页查询
USE [APS_Future_FT] GO /****** Object: StoredProcedure [dbo].[A_PagingAndSorting] Script Date: 2013/ ...
- rc.local 开机自启脚本无法启动
1.看是否rc.local 第一行如果是 #!/bin/sh -e 改成 #!/bin/bash sudo systemctl enable rc-local.service 2.看rc.local的 ...
- Linux实用指令(2)
cat指令 cat 查看文件内容,只读的方式 • 基本语法 cat [选项] 要查看的文件 • 常用选项 -n :显示行号 • 应用实例 注意:cat 只能浏览文件,而不能 ...