error: command 'clang' failed with exit status 1 when install pycurl in mac

created at 08-26-2021 views: 26

background

install pycurl:

 python3 -m pip install pycurl

and get the error 

...
    #error architecture not supported
     ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 
...

Analysis of reasons:

From the above error message, you can see that the last error shows that clang has an error, so it is speculated that it should be an error caused by the compiler, because the new version of the xcode command tool uses the arm version of the compilation method by default, and if we want to use For x86 architecture, we need to manually set the specific architecture through environment variables.

Solution

Enter the following command in the terminal:

export ARCHFLAGS="-arch x86_64"

Then re-execute the installation command, it will be solved!

created at:08-26-2021
edited at: 08-26-2021: