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版本能不能正常运行。

相关推荐
LaughingZhu8 分钟前
Product Hunt 每日热榜 | 2026-02-14
数据库·人工智能·经验分享·神经网络·搜索引擎·chatgpt
大模型探员9 分钟前
告别答非所问!深度解析文档切分如何决定RAG的搜索上限
人工智能
民乐团扒谱机18 分钟前
【读论文】深度学习中的卷积算术指南 A guide to convolution arithmetic for deep learning
人工智能·深度学习·神经网络·机器学习·cnn·卷积神经网络·图像识别
geovindu24 分钟前
python: Memento Pattern
开发语言·python·设计模式·备忘录模式
byzh_rc38 分钟前
[深度学习网络从入门到入土] 拓展 - Inception
网络·人工智能·深度学习
阿里巴巴淘系技术团队官网博客42 分钟前
从应用架构的视角看退小宝AI助手落地现状
人工智能·架构
寻星探路1 小时前
【JVM 终极通关指南】万字长文从底层到实战全维度深度拆解 Java 虚拟机
java·开发语言·jvm·人工智能·python·算法·ai
Elastic 中国社区官方博客1 小时前
DevRel 通讯 — 2026 年 2 月
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·jina
lbb 小魔仙1 小时前
【Java】Java 实战项目:手把手教你写一个电商订单系统
android·java·python
一个天蝎座 白勺 程序猿1 小时前
飞算JavaAI:从情绪价值到代码革命,智能合并项目与定制化开发新范式
人工智能·ai·自动化·javaai