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

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
社会演员多的头像社会演员多普通用户
上一篇 2023年3月11日
下一篇 2023年3月11日

相关推荐