“git.exc.GitCommandNotFound:[WinError 2]系统找不到指定的文件“Python 3.5中的error”

2024-09-28 15:25:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用Pycharm 5.0.4中的python3.5和CLTK库对拉丁文本进行柠檬化,但是Git似乎有问题。我得到了错误git.exc.GitCommandNotFound: [WinError 2] The system cannot find the file specified以及我认为与之相关的其他错误,请参阅下面的完整输出。我已经尝试将Git存储库添加到项目文件夹并添加git.exe文件到版本控制的路径,但似乎什么也没做。我能做些什么来让Git正常工作请记住,当涉及到Python时,我是一个完全的新手,对一般编程不是很有经验。在

代码:

from cltk.stem.lemma import LemmaReplacer
from cltk.stem.latin.j_v import JVReplacer
from cltk.corpus.utils.importer import CorpusImporter
corpus_importer = CorpusImporter('latin')
corpus_importer.import_corpus('latin_text_latin_library')
corpus_importer.import_corpus('latin_models_cltk')

#corpus_importer.import_corpus('phi5', '~/PHI5/')
#t.convert_corpus(corpus='phi5')

j = JVReplacer()
lemmatizer = LemmaReplacer('latin')
In = open("CIC.txt","rt")
Out = open("CIC4.txt","wt")
text = In.read()
text = text.lower()
text = j.replace(text)
Out.write(str(lemmatizer.lemmatize(text)))

In.close()
Out.close()

输出:

^{pr2}$

Tags: textinfromimportgit错误corpusout
2条回答

您可以从https://github.com/cltk/latin_models_cltk手动下载语料库并将其放在 ~/cltk_data/latin/model/文件夹(因此~/cltk_data/latin/model/latin_models_cltk/lemmata/是之后的现有文件夹)。然后您应该能够运行以下各项:

from cltk.stem.lemma import LemmaReplacer
LemmaReplacer('latin').lemmatize('some_latin_here')

对于同样的希腊语,只需在这些说明中将“拉丁语”替换为“希腊语”。我想(但还没有尝试过)它对其他语言也同样有效。在

我非常确定CLTK不能与任何低于3.6的Python版本一起工作,至少在2017年8月。我花了一段时间在Ubuntu上安装了3.6(ubuntulinus在我的电脑上运行双引导),但最终还是成功了。另外,我还通过遵循https://disiectamembra.wordpress.com/2016/07/01/current-state-of-the-cltk-latin-lemmatizer/处的说明,专门解决了OP在上面阐明的问题。祝你好运!在

相关问题 更多 >