win
1.bug
今天想在windows训练Faster_RCNN网络,用到的数据集是coco2012数据集,结果出现bug:
没有安装pycocotools库,于是想cmd中直接输入:
pip install pycocotools
安装失败,也试了:
pip install pycocotools-win
安装也失败,这下就尴尬了。。。
2. 解决办法
网上说要先装vc++ 14.0及以上,而这个我确信装了(已安装vs2017),应该不是这个问题,于是尝试cmd中输入:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
还是报错了,一查才知道,需要Git环境下输入安装指令,于是先参考这个安装教程安装Git,之后打开Git,输入:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
结果终于在win10下安装pycocotools成功。。。
ubuntu18.04
ubuntu下直接pip安装,好像一直被墙的原因,安装不成功;
pip install pycocotools
只能尝试先下载再编译安装的方法了
但是从如下链接下载的都比较老,就是2.0版本的pycocotools;
- https://github.com/cocodataset/cocoapi
- https://github.com/philferriere/cocoapi#subdirectory=PythonAPI
最后找到一个能下载新版本的pycocotools链接:
进入这个链接后,直接下载pycocotools-2.0.2.tar.gz (我下载是是这个版本),下载后解压得到pycocotools-2.0.2文件夹;
在终端进入到这个文件夹,输入安装指令:
# 我直接输入的第二条就安装成了
python setup.py build_ext --inplace
python setup.py build_ext install
安装后可看到:
可进入python环境,并import pycocotools 并回车,不出错就是安装成功了…