mpi4py、pycocotools报错

安装 mpi4py 库时出现编译报错,报错信息为:

复制代码
 gcc -pthread -B /root/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/root/anaconda3/include/python3.7m -c _configtest.c -o _configtest.o
  _configtest.c:2:10: fatal error: mpi.h: No such file or directory
   #include <mpi.h>
            ^~~~~~~
  compilation terminated.
  failure.
  removing: _configtest.c _configtest.o
  error: Cannot compile MPI programs. Check your configuration!!!

sudo apt-get update

sudo apt install libopenmpi-dev

解决掉上面的报错问题,出现下面的

复制代码
collect2: error: ld returned 1 exit status                                                                                                                                                                                                                                      
failure.                                                                                                                                                                                                                                                                        
removing: _configtest.c _configtest.o                                                                                                                                                                                                                                           
error: Cannot link MPI programs. Check your configuration!!!            

参考

sudo apt install python3-mpi4py (但是不管用,又试了下conda)

conda install mpi4py (通过)

但是pycocotools报错

复制代码
/overlay/lib/python3.10/site-packages/numpy/core/include -I./common -I/data/anaconda3/envs/sd-webui/include/python3.10 -c ../common/maskApi.c -o build/temp.linux-x86_64-cpython-310/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
      gcc: error: ../common/maskApi.c: No such file or directory
      gcc: fatal error: no input files
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycocotools
Failed to build pycocotools

有人说 conda install Cython 但我不管用,你们可以试试。

pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

最后通过这个装了pycocotools 2.0版本,但要求是pycocotools==2.0.4,不过2.0.4死活不能装起,可以试试2.0版本能不能正常运行。

相关推荐
2601_965449084 分钟前
开源工具做推广没预算?AI自动生成宣传视频的方案
人工智能·开源·音视频
会博通·代码搬运工8 分钟前
粮食加工企业档案系统,如何对接 MES/ERP 与质检?——会博通采集与适配实践
人工智能·档案管理·企业数字化·ai赋能·档案系统·知识资产
愤怒火龙果9 分钟前
AI攻防 AIRT03-RAG Exploitation & Vector Database Attacks
数据库·人工智能·网络安全
孟健12 分钟前
Claude Code 接入 DeepSeek V4.1 与 MiniMax M3.1 实测:200+ TPS 下的代码准确率与 Token 账单
人工智能·llm·ai编程
戴西软件19 分钟前
制造研发中的AI视觉与仿真:戴西工程图纸智能审图智能体、戴西3DViz_CAE AI集成与戴西3DViz_CAD AI集成
大数据·运维·人工智能·3d·自动化·制造·rpa
智联视频超融合平台23 分钟前
AI大模型与智能监控的融合:开启安防新时代
人工智能
Pin_Qing23 分钟前
账单没超,请求先被拒了
大数据·开发语言·人工智能
2601_9628857225 分钟前
如何用 Python 计算 VaR 和 CVaR(在险价值)?
开发语言·python
苏宸啊27 分钟前
Reactor反应堆模式
linux
杨杨杨大侠30 分钟前
DeepSeek Harness:连 Agent Loop 都能替换的插件架构
java·人工智能·agent