无法在python中导入git

2024-09-27 21:30:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我正面临这些问题。你能帮我做同样的事吗? 为什么我看到这个错误?我需要在要求.txt文件?在

>>> import git
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
 import git
File "git\__init__.py", line 29, in <module>
_init_externals()
File "git\__init__.py", line 23, in _init_externals
raise ImportError("'gitdb' could not be found in your PYTHONPATH")
ImportError: 'gitdb' could not be found in your PYTHONPATH

>>> from git import Repo
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
from git import Repo
File "git\__init__.py", line 29, in <module>
_init_externals()
File "git\__init__.py", line 23, in _init_externals
raise ImportError("'gitdb' could not be found in your PYTHONPATH")
ImportError: 'gitdb' could not be found in your PYTHONPATH

Tags: inpyimportgitinitlinenotbe
3条回答

我也有同样的问题。然而,gitdb和smmap已经由pip安装。当我使用brew在mac上安装python及其依赖项时,当我检查brew doctor命令时,它说我的/usr/local/sbin目录不在我的路径中。所以我把它添加到我的路径中(尽管它与python没有任何关系),最终一切都解决了。在

我还收到消息ImportError: 'gitdb' could not be found in your PYTHONPATH(当我尝试使用GitPython时)。
但是我已经安装了gitdb!
多亏了this hint,我发现gitdb由于缺少smmap而悄无声息地失败了。
所以我安装了这个,它工作了。在

您需要安装gitdb包。在

$ sudo easy_install gitdb

相关问题 更多 >

    热门问题