Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named git after reformatting laptop

Tags:

git

python

My laptop has been formatted and new OS was installed, and since then I get this error: ImportError: No module named git

This refers to a python code which simply imports git.

Location of git before my laptop was formatted: /usr/local/bin/git Location of git after the laptop was formatted: /usr/bin/git

How / what do I change in my python code to refer to right path ?

like image 707
JavaDeveloper Avatar asked Feb 12 '15 16:02

JavaDeveloper


2 Answers

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

I'm going to assume that the git module your code is importing is the one provided by the GitPython project. You'll need to install that project, see their installation instructions:

# pip install gitpython
like image 131
Martijn Pieters Avatar answered Mar 05 '23 09:03

Martijn Pieters


In my cas, I installed pythong2-git, it solved my problem.

sudo apt-get install python3-git
like image 28
Thibaud Hulin Avatar answered Mar 05 '23 10:03

Thibaud Hulin