Alexey Starinsky
Alexey Starinsky

Reputation: 4339

How to install gitpython in GitBash on Windows?

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?

Upvotes: 1

Views: 73

Answers (2)

Alexey Starinsky
Alexey Starinsky

Reputation: 4339

I installed Python in Windows Sandbox from EXE package and copied its binaries to the working machine, see here for details.

Upvotes: 0

SHIVAM KUMAR YADAV
SHIVAM KUMAR YADAV

Reputation: 1

Install pip: Download get-pip.py and run python get-pip.py to install pip. Update PATH: Add Python’s Scripts folder to your PATH (e.g., C:\dev\tools\python-3.13.2\Scripts). Verify pip: Run python -m pip --version to check if pip works. Install packages: Use python -m pip install gitpython to install packages.

Upvotes: 0

Related Questions