0. 电脑配置
win 8.1,64位操作系统。
python 2.7
1. 使用pip安装pyltp
运行安装命令:
pip install pyltp
第一次失败:缺少Visual C++ 9.0
参考资料:https://blog.youkuaiyun.com/MebiuW/article/details/52496920
于是下载Microsoft VC++ Compiler for Python 2.7。并安装成功。
安装VC过程中曾经报错:Error 2503, 2502
参考资料:https://jingyan.baidu.com/article/a501d80cec07daec630f5e18.html
问题解决。Microsoft VC for Python 2.7安装成功。
第二次失败:cl.exe failed with exit status 2
参考资料:https://blog.youkuaiyun.com/laoyaotask/article/details/45312905
于是将“C:\\…………\\cl.exe”的路径加入到环境变量Path中。
第三次失败:cl.exe failed with exit status 2
依然是上述问题。在网上找了好多方法,都没有解决。
参考资料:https://bbs.youkuaiyun.com/topics/392299647https://bbs.youkuaiyun.com/topics/392299647。更改了pyltp的安装版本。成功。
pip install pyltp==0.1.9.1
2. 模型下载
下载地址:http://ltp.ai/。我下载的是versiton 3.4.0。解压后1G多。
该文件夹可以被放在任何的路径中。我将其放在了这里。
3. pyltp的运行
参考https://blog.youkuaiyun.com/MebiuW/article/details/52496920中的例子。
在Pycharm中运行成功。