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

“;git.exc.GitCommandNotFound:[WinError 2]系统找不到指定的文件”;Python 3.5中的错误,python,git,Python,Git,我试图使用Pycharm 5.0.4中的Python3.5和CLTK库对拉丁语文本进行元素化,但Git似乎有问题。我发现错误git.exc.GitCommandNotFound:[WinError 2]系统找不到指定的文件以及其他我认为相关的错误,请参见下面的完整输出。我曾尝试将Git存储库添加到项目文件夹中,并将Git.exe路径添加到版本控制中,但似乎没有任何效果。我该怎么做才能让Git正常工作请记住,对于Python,我是一个完全的新手,一般来说,我对编程不是很有经验 代码: 输出: C:

我试图使用Pycharm 5.0.4中的Python3.5和CLTK库对拉丁语文本进行元素化,但Git似乎有问题。我发现错误
git.exc.GitCommandNotFound:[WinError 2]系统找不到指定的文件
以及其他我认为相关的错误,请参见下面的完整输出。我曾尝试将Git存储库添加到项目文件夹中,并将Git.exe路径添加到版本控制中,但似乎没有任何效果。我该怎么做才能让Git正常工作请记住,对于Python,我是一个完全的新手,一般来说,我对编程不是很有经验

代码:

输出:

C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 58508 --file C:/Users/Rune/PycharmProjects/untitled/Pucker.py
pydev debugger: process 14648 is connecting

Connected to pydev debugger (build 143.1919)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\cmd.py", line 604, in execute
    **subprocess_kwargs
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 950, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1220, in _execute_child
    startupinfo)
  File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydev_monkey.py", line 387, in new_CreateProcess
    return getattr(_subprocess, original_name)(appName, patch_arg_str_win(commandLine), *args)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cltk\corpus\utils\importer.py", line 134, in import_corpus
    Repo.clone_from(git_uri, target_dir, depth=1)
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\repo\base.py", line 885, in clone_from
    return cls._clone(git, url, to_path, GitCmdObjectDB, progress, **kwargs)
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\repo\base.py", line 826, in _clone
    v=True, **add_progress(kwargs, git, progress))
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\cmd.py", line 450, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\cmd.py", line 878, in _call_process
    return self.execute(make_call(), **_kwargs)
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\cmd.py", line 607, in execute
    raise GitCommandNotFound(str(err))
git.exc.GitCommandNotFound: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\logging\__init__.py", line 980, in emit
    msg = self.format(record)
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\logging\__init__.py", line 830, in format
    return fmt.format(record)
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\logging\__init__.py", line 567, in format
    record.message = record.getMessage()
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\logging\__init__.py", line 330, in getMessage
    msg = msg % self.args
TypeError: not enough arguments for format string
Call stack:
  File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydevd.py", line 2411, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydevd.py", line 1802, in run
    launch(file, globals, locals)  # execute the script
  File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/Rune/PycharmProjects/untitled/Pucker.py", line 5, in <module>
    corpus_importer.import_corpus('latin_text_latin_library')
  File "C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cltk\corpus\utils\importer.py", line 136, in import_corpus
    logger.error("Git clone of '%s' failed: '%s'", (git_uri, e))
Message: "Git clone of '%s' failed: '%s'"
Arguments: (('https://github.com/cltk/latin_text_latin_library.git', GitCommandNotFound('[WinError 2] The system cannot find the file specified',)),)

Process finished with exit code 0
C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\Python.exe“C:\Program Files(x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydev.py”--多进程--qt支持--客户端127.0.0.1--端口58508--文件C:/Users/Rune/PyCharm项目/untitled/Pucker.py
pydev调试器:进程14648正在连接
已连接到pydev调试器(build 143.1919)
---记录错误---
回溯(最近一次呼叫最后一次):
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site packages\git\cmd.py”,第604行,在execute中
**子流程
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py”,第950行,在uu init中__
恢复信号,启动新会话)
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py”,第1220行,在执行子进程中
startupinfo)
文件“C:\Program Files(x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydev\u monkey.py”,第387行,位于新的\u CreateProcess中
返回getattr(_子进程,原始名称)(appName,patch_arg_str_win(命令行),*args)
FileNotFoundError:[WinError 2]系统找不到指定的文件
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
导入语料库中的文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site packages\cltk\corpus\utils\importer.py”,第134行
Repo.clone\u from(git\u uri,target\u dir,depth=1)
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site packages\git\repo\base.py”,第885行,位于clone\u from
返回cls.\u克隆(git、url、to\u路径、GitCmdObjectDB、progress、**kwargs)
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site packages\git\repo\base.py”,第826行,在克隆中
v=真,**添加进度(kwargs、git、进度))
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site packages\git\cmd.py”,第450行,在
返回lambda*args,**kwargs:self.\u调用\u进程(名称,*args,**kwargs)
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site packages\git\cmd.py”,第878行,在调用过程中
返回self.execute(make_call(),**kwargs)
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site packages\git\cmd.py”,第607行,在execute中
raise GitCommandNotFound(str(err))
git.exc.GitCommandNotFound:[WinError 2]系统找不到指定的文件
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\logging\ \uuuu init\uuuu.py”,第980行,在emit中
msg=self.format(记录)
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\logging\\ uuuu init\uuuu.py”,第830行,格式为
返回格式(记录)
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\logging\\uuuu init\uuuu.py”,第567行,格式为
record.message=record.getMessage()
文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\logging\\ uuu init\uuu.py”,第330行,在getMessage中
msg=msg%self.args
TypeError:格式字符串的参数不足
调用堆栈:
文件“C:\Program Files(x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydevd.py”,第2411行,在
globals=debugger.run(setup['file'],None,None,is_模块)
文件“C:\Program Files(x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\pydevd.py”,第1802行,正在运行
启动(文件、全局、局部)#执行脚本
文件“C:\Program Files(x86)\JetBrains\PyCharm 5.0.4\helpers\pydev\\u pydev\u imps\\u pydev\u execfile.py”,执行文件第18行
exec(编译(内容+“\n”,文件,'exec'),全局,loc)
文件“C:/Users/Rune/PycharmProjects/untitled/Pucker.py”,第5行,在
语料库导入器。导入语料库(“拉丁语文本库”)
导入语料库中的文件“C:\Users\Rune\AppData\Local\Programs\Python\Python35-32\lib\site packages\cltk\corpus\utils\importer.py”,第136行
logger.error(“对“%s”的Git克隆失败:“%s”(Git_uri,e))
消息:“对“%s”的Git克隆失败:“%s”
参数:('https://github.com/cltk/latin_text_latin_library.git,GitCommandNotFound('[WinError 2]系统找不到指定的文件',),)
进程已完成,退出代码为0

您可以从
https://github.com/cltk/latin_models_cltk
并将其放置在
~/cltk\u data/latin/model/
文件夹(因此
~/cltk\u data/latin/model/latin\u models\u cltk/lemmata/
之后是一个现有文件夹)。然后,您应该能够很好地运行以下各项:

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

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

我很确定CLTK不适用于3.6以下的任何Python版本,至少截至2017年8月。我花了很长时间在Ubuntu上安装了3.6(Ubuntu linus从我的笔记本电脑上运行双启动),但最终还是成功了。此外,我还通过遵循中的说明,具体解决了OP在上面阐述的问题。祝你好运

非常感谢您的回复!我会尽快测试它,并给予应有的信任。
from cltk.stem.lemma import LemmaReplacer
LemmaReplacer('latin').lemmatize('some_latin_here')