You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu系统下无法通过pip安装python-igraph的问题求助

Fixing "Error Code 1" When Installing python-igraph via sudo pip on Ubuntu

Ah, I’ve run into this exact headache before when setting up python-igraph on Ubuntu! That error code 1 almost always happens because pip can’t compile the Python wrapper—it’s missing the underlying C igraph library and build tools. Let’s fix this step by step:

  • First, install the system-level dependencies needed to compile python-igraph. Fire up your terminal and run this command:

    sudo apt-get update && sudo apt-get install build-essential libigraph0-dev
    

    This grabs the C core of igraph plus the compilers and headers required to build the Python package.

  • Next, try installing python-igraph again. A quick note: I’d suggest avoiding sudo pip if possible (it can mess with your system’s default Python setup). If you’re using a virtual environment, just run:

    pip install python-igraph
    

    If you absolutely need a system-wide install, you can still use sudo, but proceed carefully:

    sudo pip install python-igraph
    
  • If compilation still fails, skip the PyPI package entirely and use Ubuntu’s pre-built version. It might be a little older, but it’s guaranteed to work without compile errors:

    sudo apt-get install python-igraph
    

Quick Troubleshooting Tip

If you’re still seeing errors, double-check which Python version you’re targeting. If you’re using Python 3, make sure you’re using pip3 instead of pip:

pip3 install python-igraph

内容的提问来源于stack exchange,提问作者Möbius

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:07:33