关于使用中文文本纠错工具--pycorrector的问题集

关于使用中文文本纠错工具–pycorrector的问题集

————————————————

本博客旨在记录博主在配置pycorrector需求的环境时遇到的各种问题,希望对想使用此工具的小伙伴有所帮助呦!

除此之外,一个python萌新也希望各位大佬能够指出本文问题所在(如果有的话)!!

Pycorrecter–>GithHub链接:https://github.com/shibing624/pycorrector

Pycorrector安装:

Python语言:python 3.5
Anocanda版本:anocanda3 2019.03(python3.7.3 64–bt)
Git version 2.24.0.2 (安装教程:https://blog.csdn.net/qq_32863339/article/details/102791024)
Microsoft Visual Studio 14.0 ;

一、创建python3.5虚拟环境

conda env list 可以看到所有python环境,前面有个‘*’的代表当前环境:
conda create --name py35 python=3.5 代表创建一个python3.5的环境,我们把它命名为py35
使用activate py35 来激活刚才创建的环境
(附注:使用pip list 来查看当前环境下你安装了哪些package)

二、安装pycorrector工具(请先下载上面GitHub链接中的pycorrector-master压缩包,后面会用到)
全自动安装:
pip3 install pycorrector
(成功,附注:使用此方法会让你安装相关包,直接pip安装就行了,最后会报一个错误:说是没有0.2.0版本的pycorrector,所以我安装的是0.1.9版本的)

半自动安装:
git clone https://github.com/shibing624/pycorrector.git(此方法下载速度较慢,可能是网速问题,我就放弃了)

cd pycorrector(没试过)

python3 setup.py install(失败了,附注:从上面的github链接中下载pycorrector-master(版本0.2.0)压缩包解压,进入py35,使用cd命令进入pycorrector-master文件路径,使用python3 setuo.py install,报’python3’ 不是内部或外部命令,也不是可运行的程序或批处理文件错误,使用python setuo.py install报TypeError: join() argument must be str or bytes, not 'WindowsPath’错误,未解决)

三、安装依赖

1.pip3 install -r requirements.txt :直接使用此命令。

jieba、scipy、scikit-learn自己就安装了,如果没有用pip;
pypinyin会报错,用pip;
kenlm==0.0.0报错,1.使用pip install https://github.com/kpu/kenlm/archive/master.zip命令,2. https://github.com/kpu/kenlm/archive/master.zip,使用setup安装。

2.pip3 install -r requirements-dev.txt:用cd命令进入pycorrector-master路径下使用此命令。
在这里插入图片描述
使用pip install mock==2.0.0 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com 命令
在这里插入图片描述
自带shutil,解决办法就是把shutil从requirements-dev.txt中手动删除。

在这里插入图片描述
使用pip install https://github.com/pytorch/text/archive/master.zip 命令,多试几次就好了。

在这里插入图片描述
使用pip install torch==0.4.1 -f https://download.pytorch.org/whl/torch_stable.html 命令,这个torch似乎是Linux里面才有相应版本
,详情请查看:https://blog.csdn.net/weixin_41010198/article/details/103107083

在这里插入图片描述
使用 git clone https://github.com/google/sentencepiece 命令,下载较慢

keras-contrib==2.0.8 问题:通过https://blog.csdn.net/qq_32863339/article/details/102791024,安装好git后,使用pip install git+https://www.github.com/keras-team/keras-contrib.git 命令安装,因为博主在py35中安装失败,于是走了一个捷径:在base里用此命令能够安装成功,于是博主将通过寻找base里的包路径得到如下两个文件,然后复制粘贴进入py35中同样的路径下,成功解决。
在这里插入图片描述

如若出现类似于 tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you’ll have setuptools 40.6.3 which is incompatible. 的错误:请更新wrapt,setuptools,使用pip install --ignore-installed wrapt,pip install --ignore-installed setuptools命令。

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值