如何在Windows中使用gitstats和git时修复错误

时间:2013-10-30 11:06:42

标签: windows git

我正在学习如何使用gitstats使用git创建报告。所以我下载并安装了Git-1.8.1.2-preview20130201.exe,python-2.6.2.msi,gp463-win32-setup.exe(gnuplot)和克隆的gitstats

来自http://gitstats.com/

。我还将我的git,python,gnuplot,gitstats添加到我的PATH中。然后我创建了一个名为repo1的名为“Git Bash”的存储库。但是当我输入命令来创建

报告有关repo1的信息,它输出如下错误:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
C:\Users\Dynamsoft220\Desktop>e:
E:\>cd Jeremy\Git\gitstats
E:\Jeremy\Git\gitstats>python gitstats e:\Jeremy\Git\repo1 e:\Jeremy\Git\report
[0.08100] >> gnuplot --version
Output path: e:\Jeremy\Git\report
Git path: e:\Jeremy\Git\repo1
Collecting data...
[0.12600] >> git shortlog -s HEAD | wc -l
[0.08300] >> git show-ref --tags
[0.18100] >> git rev-list --pretty=format:"%at %ai %aN <%aE>" HEAD | grep -v ^co
mmit
[0.09300] >> git rev-list --pretty=format:"%at %T" HEAD | grep -v ^commit
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
    prepare(preparation_data)
  File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
    file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats

我真的不知道如何修复此错误。其实我想也许是因为软件版本太晚了,但似乎没有!对于大多数人来说,讨论似乎太简单了

TT,所以我找不到很多关于它的文章。任何建议将不胜感激!感谢〜

3 个答案:

答案 0 :(得分:10)

我在使用Windows运行gitstats时遇到了问题。首先,我确保添加了python的路径:

C:\> set PYTHON_PATH=C:\Python27;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk
C:\> set PATH=%PATH%;%PYTHON_PATH%

接下来,我添加了gitstats的路径,因为,为什么不在这一点:

C:\> set PATH=%PATH%;c:\projects\gitstats

最后,我将gitstats重命名为gitstats.py,它在github上的问题日志中提到,并在那里由@danio解决: https://github.com/hoxu/gitstats/issues/34

答案 1 :(得分:0)

您必须在PYTHON_PATH中添加gitstat文件夹。

有关如何在Windows中添加PYTHON_PATH的信息,请参阅此答案。 https://stackoverflow.com/a/3701730/1226582

答案 2 :(得分:0)

在 Windows 中运行 gitstats 的更完整的说明:

现在在 git bash 中运行

如果你还没有下载:“安装”gitstats

  • git clone git://github.com/hoxu/gitstats.git
  • cd gitstats

现在每次要运行它时,首先将 Python 2 临时添加到您的 PATH(前面)以便 gitstats 可以使用它:

  • PYTHON_PATH=/C/Python27:/C/Python27/Lib:/C/Python27/DLLs:/C/Python27/Lib/lib-tk
  • PATH=$PYTHON_PATH:$PATH:"/C/Program Files/gnuplot/bin"
  • python gitstats /C/path/to/repo/to/analyze /C/path/to/output/dir
  • 现在在浏览器中打开 C:\path\to\output\dir\index.html