Я хотел бы спросить, как решить эту проблему - PullRequest
0 голосов
/ 26 ноября 2018
Traceback (most recent call last):
  File "/home/shi/anaconda3/lib/python3.6/site-packages/git/__init__.py", line 83, in <module>
    refresh()
  File "/home/shi/anaconda3/lib/python3.6/site-packages/git/__init__.py", line 73, in refresh
    if not Git.refresh(path=path):
  File "/home/shi/anaconda3/lib/python3.6/site-packages/git/cmd.py", line 290, in refresh
    raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "github-scraper/scraper.py", line 5, in <module>
    from PyRepo import PyRepo
  File "/home/shi/PycharmProjects/pycodesuggest-master/github-scraper/PyRepo.py", line 2, in <module>
    from git import Repo
  File "/home/shi/anaconda3/lib/python3.6/site-packages/git/__init__.py", line 85, in <module>
    raise ImportError('Failed to initialize: {0}'.format(exc))
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet

1 Ответ

0 голосов
/ 26 ноября 2018

Я думаю, что сообщение очень ясно о том, что происходит: git отсутствует в PATH .Сценарий python, который жалуется, вероятно, делает вызов для запуска "git".Чтобы это работало, каталог исполняемого файла git должен быть включен как каталог в PATH.Если это не так, то вызов с треском провалится.Другой возможностью является установка другой переменной среды (GIT_PYTHON_EXECUTABLE), где вы можете указать местоположение самого исполняемого файла git, если он не находится в PATH, и вы не хотите связываться с переменной PATH.

...