python 安装pygit2失败

错误信息

这是最后一部分输出

  In file included from src/blob.c:30:0:
  src/blob.h:33:10: fatal error: git2.h: 没有那个文件或目录
   #include <git2.h>
            ^~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pygit2
Failed to build pygit2
ERROR: Could not build wheels for pygit2 which use PEP 517 and cannot be installed directly

原因

是因为Python的版本太低了。现在是3.6,我更新到3.9后就好了。更新命令

 conda update python