麻烦在mac 10.8.5上安装pycurl

时间:2013-10-09 20:51:20

标签: python macos libcurl pycurl

我在我的女朋友的mac上安装pycurl时遇到了麻烦,我设法自己做了但是我不记得哪个命令带来了成功。我在她的Mac上尝试的一切都不起作用。

我查了一下我能找到的关于如何安装pycurl的答案,没有任何对我有用:(。我试过macports,也没用。问题是,我不是那个使用终端

这是我到目前为止所尝试的内容:

sudo port install py27-yaml
sudo port install py27-curl
/opt/local/bin/python2.7
import pycurl

但是id没有'工作:(

尝试sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl==7.19.0

带给我这个

Last login: Wed Oct  9 23:51:34 on ttys000
Loras-MacBook-Air:~ Lora$ sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl==7.19.0
Searching for setuptools
Best match: setuptools 0.6c12dev-r88846
setuptools 0.6c12dev-r88846 is already the active version in easy-install.pth
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin

Using /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Processing dependencies for setuptools
Finished processing dependencies for setuptools
Searching for pycurl==7.19.0
Reading http://pypi.python.org/simple/pycurl/
Reading http://pycurl.sourceforge.net/
Reading http://pycurl.sourceforge.net/download/
Best match: pycurl 7.19.0
Downloading http://pycurl.sourceforge.net/download/pycurl-7.19.0.tar.gz
Processing pycurl-7.19.0.tar.gz
Running pycurl-7.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-r7sdRe/pycurl-7.19.0/egg-dist-tmp-DKaHyW
Using curl-config (libcurl 7.32.0)
clang: warning: argument unused during compilation: '-mno-fused-madd'
src/pycurl.c:1168:16: warning: implicit conversion loses integer precision:
      'long' to 'int' [-Wshorten-64-to-32]
            ret = dup(PyInt_AsLong(fileno_result));
                  ~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pycurl.c:1912:31: warning: implicit conversion loses integer precision:
      'long' to 'int' [-Wshorten-64-to-32]
                        val = PyLong_AsLong(PyTuple_GET_ITEM(t, j));
                            ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pycurl.c:2904:22: warning: implicit conversion loses integer precision:
      'long' to '__darwin_suseconds_t' (aka 'int') [-Wshorten-64-to-32]
        tv.tv_usec = (long)(timeout*1000000.0);
                   ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
zip_safe flag not set; analyzing archive contents...
Adding pycurl 7.19.0 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/pycurl-7.19.0-py2.7-macosx-10.8-x86_64.egg
Processing dependencies for pycurl==7.19.0
Finished processing dependencies for pycurl==7.19.0
Loras-MacBook-Air:~ Lora$ 

我无法完成任务:(

3 个答案:

答案 0 :(得分:2)

Xcode 5.1中的Apple LLVM编译器将无法识别的命令行选项视为错误。在构建Python本机扩展和Ruby Gems时已经看到了这个问题,其中当前指定了一些无效的编译器选项。来自Kasper Munck

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install-2.7  pycurl

答案 1 :(得分:0)

我没有mac,但我认为输出相对清晰:

port: command not found

这可能意味着没有安装任何macports,你需要先做。如果您按照here的说明操作,这似乎很容易。之后你就可以使用port命令。

答案 2 :(得分:-1)

我建议您不要使用port,而是下载并安装brew+pip,然后使用pycurl安装pip。这些是步骤

1)Homebrew 或者直接在终端输入“ruby -e”curl -fsSL https://raw.github.com/mxcl/homebrew/go“(没有最外面的引用)

2)然后通过输入终端安装pip:“brew install pip in shell”

3)然后再次在终端“sudo pip install pycurl”