Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unable to import git module in python #1837

Closed
@ANIKET200915

Description

@ANIKET200915

Today while working on a project on Python I needed to import git module so in I opened CMD and entered the following commandpip install GitPython to install git then when I went to test the module on CMD by opening python shell and typingimport git I got an error message

`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 message 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|silent|none|n|0: for no message or exception    - warn|w|warning|log|l|1: for a warning message (logged at level CRITICAL, displayed by default)    - error|e|exception|raise|r|2: for a raised exceptionExample:    export GIT_PYTHON_REFRESH=quietThe above exception was the direct cause of the following exception:Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\git\__init__.py", line 142, in <module>    raise ImportError("Failed to initialize: {0}".format(_exc)) from _excImportError: 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 message 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|silent|none|n|0: for no message or exception    - warn|w|warning|log|l|1: for a warning message (logged at level CRITICAL, displayed by default)    - error|e|exception|raise|r|2: for a raised exceptionExample:    export GIT_PYTHON_REFRESH=quiet`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp