安装pycocotools报无效的数值参数“/Wno-cpp”错误

win7 sp1 + vs2019环境下执行pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'报出

cl: 命令行 error D8021 :无效的数值参数“/Wno-cpp”

错误。

解决方法:

首先执行

git clone https://github.com/cocodataset/cocoapi.git

然后cd到PythonAPI目录下。

修改setup.py文件。

将
extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
改为
extra_compile_args=['-std=c99'],

保存后执行

python setup.py build_ext --inplace
python setup.py build_ext install
原文地址:https://www.cnblogs.com/tiandsp/p/12303352.html