ImportError: no module named git after reformatting laptop

My laptop was formatted and a new OS was installed, and since then I get this error: ImportError: there is no module named git

This refers to python code that just imports git.

Git location before formatting my laptop: / usr / local / bin / git Git location after formatting my laptop: / usr / bin / git

How / what can I change in my Python code to reference the correct path?

+14
git python
source share
3 answers

The git module is not the same as the git command line executable. They have the same name and related tasks, but they are different software packages.

I am going to assume that the git module that imports your code is the one provided by the GitPython project . You will need to install this project, see the instructions:

 # pip install gitpython 
+32
source share

I installed pythong2-git in my cas, this solved my problem.

 sudo apt-get install python3-git 
+2
source share

In my case, apt install python-git fixed the problem.

0
source share

All Articles