Ubuntu系统下无法通过pip安装python-igraph的问题求助
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-devThis 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 pipif possible (it can mess with your system’s default Python setup). If you’re using a virtual environment, just run:pip install python-igraphIf you absolutely need a system-wide install, you can still use sudo, but proceed carefully:
sudo pip install python-igraphIf 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

