ERROR: Cannot find command ‘git‘ - do you have ‘git‘ installed and in your PATH

Posted running鸿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ERROR: Cannot find command ‘git‘ - do you have ‘git‘ installed and in your PATH相关的知识,希望对你有一定的参考价值。

虚拟环境中,在配置coco数据集的API时出现以下错误

(py37) C:\\Users\\HASEE>pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
  Cloning https://github.com/philferriere/cocoapi.git to c:\\users\\hasee\\appdata\\local\\temp\\pip-req-build-60rcidcx
  Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\\Users\\HASEE\\AppData\\Local\\Temp\\pip-req-build-60rcidcx'
  ERROR: Error [WinError 2] 系统找不到指定的文件。 while executing command git clone -q https://github.com/philferriere/cocoapi.git 'C:\\Users\\HASEE\\AppData\\Local\\Temp\\pip-req-build-60rcidcx'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH

    主要是因为你没有在虚拟环境中安装git这个包,解决方法很简单,只要在你的pycharm中添加git这个库就行了

   然后再从终端或者cmd命令环境下输入:

pip install git+https://github.com/gautamchitnis/cocoapi.git@cocodataset-master#subdirectory=PythonAPI

若仍然无法下载,那就是网络问题了,现在下载很多库,感觉都不方便,经常无法访问。

完成后,会有下面提示:

  Cloning https://github.com/gautamchitnis/cocoapi.git (to revision cocodataset-master) to c:\\users\\hasee\\appdata\\local\\temp\\pip-req-build-1spsj_qj
  Running command git clone -q https://github.com/gautamchitnis/cocoapi.git 'C:\\Users\\HASEE\\AppData\\Local\\Temp\\pip-req-build-1spsj_qj'
  Running command git checkout -b cocodataset-master --track origin/cocodataset-master
  Branch 'cocodataset-master' set up to track remote branch 'cocodataset-master' from 'origin'.
  Switched to a new branch 'cocodataset-master'
  Resolved https://github.com/gautamchitnis/cocoapi.git to commit 20291f19c46a8d11935862bc9e449a1b72ec25ed
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (setup.py) ... done
  Created wheel for pycocotools: filename=pycocotools-2.0-cp37-cp37m-win_amd64.whl size=80448 sha256=a90734666b5eddd3b89d211565a186d5a222dabe0d4cc9d4f6d81a63003a0963
  Stored in directory: C:\\Users\\HASEE\\AppData\\Local\\Temp\\pip-ephem-wheel-cache-hbh2eneq\\wheels\\6e\\c9\\59\\56484d4d5ac1ab292a452b4c3870277256551505954fc4a1db
Successfully built pycocotools
Installing collected packages: pycocotools
Successfully installed pycocotools-2.0

以上是关于ERROR: Cannot find command ‘git‘ - do you have ‘git‘ installed and in your PATH的主要内容,如果未能解决你的问题,请参考以下文章

Error: Cannot find module

Error: Cannot find module PhantomJS

QT error: cannot find -lGL

Error: Cannot find module ‘dotenv‘解决方法

Error: Cannot find module ‘dotenv‘解决方法

Error: Cannot find module 'npmlog'