[Python] How to install gitpython in GitBash on Windows?

Discussão em 'Python' iniciado por Stack, Fevereiro 21, 2025.

  1. Stack

    Stack Membro Participativo

    I downloaded Python 3.13.2 zip archive (Windows embeddable package (64-bit)). It contains the following files:

    _asyncio.pyd
    _bz2.pyd
    _ctypes.pyd
    _decimal.pyd
    _elementtree.pyd
    _hashlib.pyd
    _lzma.pyd
    _multiprocessing.pyd
    _overlapped.pyd
    _queue.pyd
    _socket.pyd
    _sqlite3.pyd
    _ssl.pyd
    _uuid.pyd
    _wmi.pyd
    _zoneinfo.pyd
    libcrypto-3.dll
    libffi-8.dll
    libssl-3.dll
    LICENSE.txt
    pyexpat.pyd
    python.cat
    python.exe
    python3.dll
    python313._pth
    python313.dll
    python313.zip
    pythonw.exe
    select.pyd
    sqlite3.dll
    unicodedata.pyd
    vcruntime140.dll
    vcruntime140_1.dll
    winsound.pyd


    when I try the following command (that worked with Python 3.5)

    python -m pip install gitpython


    I get

    python-3.13.2\python.exe: No module named pip


    On Linux I install pip with a command like this:

    sudo apt install python3-pip


    What is the command on Windows in GitBash?

    Tried:

    $ python -m ensurepip
    C:\dev\tools\python-3.13.2\python.exe: No module named ensurepip


    and

    $ python get-pip.py
    Collecting pip
    Downloading pip-25.0.1-py3-none-any.whl.metadata (3.7 kB)
    Downloading pip-25.0.1-py3-none-any.whl (1.8 MB)
    ---------------------------------------- 1.8/1.8 MB 3.5 MB/s eta 0:00:00
    Installing collected packages: pip
    WARNING: The scripts pip.exe, pip3.13.exe and pip3.exe are installed in 'C:\dev\tools\python-3.13.2\Scripts' which is not on PATH.
    Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
    Successfully installed pip-25.0.1

    export PATH=/c/dev/tools/python-3.13.2:/c/dev/tools/python-3.13.2/Scripts:$PATH


    but still

    $ python -m pip install gitpython
    C:\dev\tools\python-3.13.2\python.exe: No module named pip

    $ pip install gitpython
    Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "C:\dev\tools\python-3.13.2\Scripts\pip.exe\__main__.py", line 4, in <module>
    from pip._internal.cli.main import main
    ModuleNotFoundError: No module named 'pip'


    pip is in the PATH:

    $ which pip
    /c/dev/tools/python-3.13.2/Scripts/pip


    but

    $ python -m pip --version
    C:\dev\tools\python-3.13.2\python.exe: No module named pip


    what does it mean?

    Continue reading...

Compartilhe esta Página