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

OS X系统下编译命令因冒号出现执行异常问题求助

Fixing GCC "No such file or directory" Error When Using Pip on Old Laptop

Hey there! Let's break down why that gcc command is throwing an error on your old laptop. The message gcc: error: :: No such file or directory is a clear clue that there's a messed-up argument in your gcc call.

The Root Cause

Looking at your gcc command, this segment is the problem:

-I/usr/local/opt/openblas/include:-I/usr/local/opt/openjdk/include :

There are two critical issues here:

  1. You’re using a colon (:) to chain two -I include paths directly after one -I prefix. GCC doesn’t recognize this syntax—each include path needs its own -I flag, or if using an environment variable like CPATH, paths are colon-separated without the -I prefixes.
  2. There’s an extra space followed by a colon ( :) at the end of that line. GCC interprets this standalone :: (from the colon in the path chain plus the extra colon) as a filename it’s supposed to compile, which obviously doesn’t exist.

Since you said this worked before, this is almost certainly a misconfigured environment variable (like CFLAGS, CPPFLAGS, or CPATH)—likely from a recent shell config change, conda/pipx environment tweak, or system update that messed up path formatting.

Step-by-Step Fixes

Let’s walk through how to resolve this:

  1. Check your environment variables
    Open your terminal and run these commands to spot broken formatting:

    echo $CFLAGS
    echo $CPPFLAGS
    echo $CPATH
    

    Look for lines with paths chained like -I...:-I... or trailing colons/spaces.

  2. Temporarily fix variables for the current session
    If you find the problematic variable (say, CPATH), reset it with properly formatted paths:

    export CPATH="/usr/local/opt/openblas/include:/usr/local/opt/openjdk/include"
    

    For CFLAGS, use separate -I flags with spaces:

    export CFLAGS="-I/usr/local/opt/openblas/include -I/usr/local/opt/openjdk/include"
    

    Then try your pip command again.

  3. Override variables directly in the pip install
    If you don’t want to adjust session-wide variables, pass corrected flags directly when installing the library:

    CFLAGS="-I/usr/local/opt/openblas/include -I/usr/local/opt/openjdk/include" pip install psutil
    
  4. Fix permanent config files
    Check your shell configs (like ~/.bashrc, ~/.zshrc, or ~/.bash_profile) and conda environment scripts for lines setting these variables incorrectly. Correct the formatting to either:

    • Colon-separated paths without -I for CPATH/CPPFLAGS
    • Space-separated -I/path entries for CFLAGS
  5. Verify the fix manually
    To confirm, adjust the broken segment in your original gcc command and run it directly. Change:

    -I/usr/local/opt/openblas/include:-I/usr/local/opt/openjdk/include :
    

    to:

    -I/usr/local/opt/openblas/include -I/usr/local/opt/openjdk/include
    

    If this runs without errors, you’ve confirmed the issue is fixed.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.09 15:37:39