Skip to main content
 首页 » 编程设计

python之在 OS X 上安装 Pycurl 时出错

2025年05月04日17zhujiabin

我正在尝试在 OS X Mavericks 上安装 pycurl。我已经下载并安装了 Xcode 开发工具以获得一些编译器。我进入 Xcode 首选项并确保我已经下载了我需要的所有编译器,但仍然出现此错误

当我尝试安装 pycurl 时,出现以下错误。任何帮助将非常感激。

local-mbp:~ $ sudo easy_install pycurl 
Password: 
Searching for pycurl 
Reading http://pypi.python.org/simple/pycurl/ 
Best match: pycurl 7.19.3.1 
Downloading https://pypi.python.org/packages/source/p/pycurl/pycurl-7.19.3.1.tar.gz#md5=6df8fa7fe8b680d93248da1f8d4fcd12 
Processing pycurl-7.19.3.1.tar.gz 
Running pycurl-7.19.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-jKMmtE/pycurl-7.19.3.1/egg-dist-tmp-9z89Ns 
Using curl-config (libcurl 7.30.0) 
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] 
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future 
error: Setup script exited with error: command 'cc' failed with exit status 1 
local-mbp:~ $ which gcc 
/usr/bin/gcc 
local-mbp:~$ which cc 
/usr/bin/cc 
local-mbp:~$ 

请您参考如下方法:

试试这个:

brew install python 

仔细检查您使用的是 brewed Python:

which python 

(应该返回类似/usr/local/bin/python的东西)

使用pip安装pycurl。

pip install pycurl 

我刚刚在 Mavericks 上测试过。