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

安装ElectrumX pip3依赖时clang执行失败,leveldb未安装

Fixing "clang failed with exit status 1" When Installing leveldb via pip3 for ElectrumX

Alright, let's work through this leveldb installation error you're facing while setting up your Electrum server. That clang failure almost always happens because you're missing the system-level development libraries and build tools that the Python leveldb wrapper needs to compile properly. Here's how to fix it step by step:

Step 1: Install System-Level Dependencies

First, you need to install the underlying leveldb library and essential build tools for your operating system:

For Debian/Ubuntu-Based Systems

Run this command to update your package list and install the required dependencies:

sudo apt-get update && sudo apt-get install libleveldb-dev build-essential
  • libleveldb-dev provides the header files and libraries needed to compile the Python leveldb package.
  • build-essential includes clang, gcc, and other tools required for compiling native extensions.

For macOS (Using Homebrew)

If you're on a Mac, use Homebrew to install the precompiled leveldb library:

brew install leveldb

This avoids the need to compile leveldb from source, which is often the root cause of the clang error. If you don't have Homebrew installed, you'll need to set that up first.

Step 2: Reinstall the Python Packages

Once the system dependencies are in place, re-run your original pip3 command to install the packages:

pip3 install aiohttp pylru leveldb plyvel

If plyvel Still Fails to Install

In some cases, plyvel might need explicit paths to the leveldb libraries. On macOS, try running this instead:

LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" pip3 install plyvel

This tells the compiler exactly where to find the leveldb files.

Step 3: Verify the Installation

After running the install command, check if leveldb and plyvel are now listed in your pip packages:

pip3 list | grep -E "leveldb|plyvel"

You should see both packages with their version numbers if the installation succeeded.

Additional Troubleshooting Tips

  • Update Clang/Command Line Tools (macOS): If you're still hitting clang errors, make sure your Command Line Tools are up to date by running xcode-select --install.
  • Use a Virtual Environment: If you're installing packages system-wide, consider using a virtual environment to avoid conflicts with existing Python packages. Activate your venv before running the pip commands.

内容的提问来源于stack exchange,提问作者Leon Gaban

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 09:21:16