我正面临这些问题。你能帮我吗?
为什么会看到此错误?我是否必须在requirements.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

最佳答案

我已经安装了gitdbsmmap,因此必须重新安装它们。

您可以通过在终端中运行以下命令来重新安装它们:pip3 install --upgrade --force-reinstall gitdb; pip3 install --upgrade --force-reinstall smmap

09-04 08:14