解决Mac中python3使用stanfordNLP的问题
一、使用问题
首先是安装过程:pip install stanfordcorenlp
在https://stanfordnlp.github.io/CoreNLP/index.html#download 中安装coreNLP和chinese.model.jar
然后解压stanfordcoreNLP,重命名为stanford_nlp后将chinese.models.jar放进stanford_nlp文件夹内。
在Pycharm中的py文件里输入
from stanfordcorenlp import StanfordCoreNLP
nlp = StanfordCoreNLP(r'/users/xxx/Downloads/stanford_nlp')
print(nlp.ner('我今天真开心。'))
nlp.close()
出现报错:
网上查询后发现是权限问题,开始找解决方法。
二、解决过程
使用terminal执行某文件:
sudo /usr/local/bin/python3.6 /Users/lisa/Documents/foodsafety/n