升级macOS Catalina后Jupyter中pip安装python-binance失败求助
pip install python-binance Error on macOS Catalina 10.15.5 Hey there, I’ve run into this exact headache after updating macOS before—let’s get this sorted out for you! The core issue jumps right out of your error logs: your Xcode Command Line Tools are either missing or have an invalid path, which breaks the compilation of the regex dependency required by python-binance.
Step 1: Repair Xcode Command Line Tools
First, let’s fix the root cause:
Open your terminal (or a new terminal tab in Jupyter Notebook) and run this command:
xcode-select --installA system dialog will pop up asking you to install the Command Line Tools. Follow the prompts to finish the installation—it might take a few minutes to download and set up.
If you get an error saying the tools are already installed but the path is still messed up, reset the path with:
sudo xcode-select --resetDouble-check the path is correct afterward by running:
xcode-select -pIt should return
/Library/Developer/CommandLineTools.
Step 2: Retry the Installation
Once the Command Line Tools are fixed, try installing python-binance again. Since you’re using Anaconda, you have two solid options:
- Use pip (now that the compilation block is removed):
pip install python-binance - Or use conda (which often skips compilation headaches by using pre-built packages):
conda install -c conda-forge python-binance
Step 3: Bonus: Upgrade Pip (If Needed)
If you still hit snags, make sure your pip is up to date—older versions can cause random compatibility issues:
pip install --upgrade pip
Why This Happens
macOS updates (like your Catalina 10.15.5 upgrade) sometimes reset or corrupt the Xcode Command Line Tools path. The regex package needs to compile a C extension, which relies on gcc and other tools from the Command Line Tools—without them, the installation can’t proceed.
内容的提问来源于stack exchange,提问作者0xyan

