Mac下安装pycurl填坑记录

为日后使用方便,特此记录

本文是安装在以下环境中
macos high sierra 10.13.5
python 2.7
pip 18.0

原文地址:https://www.jianshu.com/p/61fd0c16aef4

缘由

因为工作需要,所以要从Windows项目迁移至MAC中,在安装项目环境时候发现pycurl的安装网上资料有些乱,导致安装了两三小时才安装完成。特此记录

使用上面命令安装,排除pip超时的情况下,大多遇见如下两种错误情况:

错误一

Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting pycurl
  Downloading http://mirrors.aliyun.com/pypi/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz (214kB)
    100% |████████████████████████████████| 215kB 1.9MB/s
    Complete output from command python setup.py egg_info:
    Using curl-config (libcurl 7.54.0)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-M7SSJd/pycurl/setup.py", line 913, in <module>
        ext = get_extension(sys.argv, split_extension_source=split_extension_source)
      File "/private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-M7SSJd/pycurl/setup.py", line 582, in get_extension
        ext_config = ExtensionConfiguration(argv)
      File "/private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-M7SSJd/pycurl/setup.py", line 99, in __init__
        self.configure()
      File "/private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-M7SSJd/pycurl/setup.py", line 316, in configure_unix
        specify the SSL backend manually.''')
    __main__.ConfigurationError: Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-M7SSJd/pycurl/

错误信息是Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually,其实就是让我们在安装之前配置openssl的环境变量

首先要找到openssl的目录,没有安装的去安装(mac 新电脑可以用brew升级到最新的openssl,不然查找是不到的)。

your-name:~$     sudo find / -iname ssl.h
...
/usr/local/Cellar/openssl/1.0.2o_2/include/openssl/ssl.h
...

可以看见我的安装目录是 /usr/local/Cellar/openssl/1.0.2o_2,然后执行下面三个命令

your-name:~$ export PYCURL_SSL_LIBRARY=openssl
your-name:~$ export LDFLAGS=-L安装目录/lib
your-name:~$ export CPPFLAGS=-I安装目录/include

这三个命令官网中可以找到解释。倘若这样仍然报错,那么尝试执行下面这一个命令,进行安装(反正我是这样才安装成功的)

your-name:~$ sudo pip install pycurl  --user

错误二

Collecting pycurl
  Downloading http://mirrors.aliyun.com/pypi/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz (214kB)
    100% |████████████████████████████████| 215kB 5.9MB/s
Installing collected packages: pycurl
  Running setup.py install for pycurl ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-TL3qJK/pycurl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-record-QM2JGV/install-record.txt --single-version-externally-managed --compile:
    Using curl-config (libcurl 7.54.0)
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-intel-2.7
    creating build/lib.macosx-10.13-intel-2.7/curl
    copying python/curl/__init__.py -> build/lib.macosx-10.13-intel-2.7/curl
    running build_ext
    building 'pycurl' extension
    creating build/temp.macosx-10.13-intel-2.7
    creating build/temp.macosx-10.13-intel-2.7/src
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/open -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/docstrings.c -o build/temp.macosx-10.13-intel-2.7/src/docstrings.o
    In file included from src/docstrings.c:4:
    src/pycurl.h:164:13: fatal error: 'openssl/ssl.h' file not found
    #   include <openssl/ssl.h>
                ^~~~~~~~~~~~~~~
    1 error generated.
    error: command 'cc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-TL3qJK/pycurl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-record-QM2JGV/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-TL3qJK/pycurl/

出现这个错误大多是由于错误一的目录没有设置对(或者根本没有设置)引起的,想解决重新读错误一

错误三

Collecting pycurl
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-19vBHu/pycurl/setup.py", line 913, in <module>
        ext = get_extension(sys.argv, split_extension_source=split_extension_source)
      File "/tmp/pip-build-19vBHu/pycurl/setup.py", line 582, in get_extension
        ext_config = ExtensionConfiguration(argv)
      File "/tmp/pip-build-19vBHu/pycurl/setup.py", line 99, in __init__
        self.configure()
      File "/tmp/pip-build-19vBHu/pycurl/setup.py", line 227, in configure_unix
        raise ConfigurationError(msg)
    __main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-19vBHu/pycurl/

出现了这个问题是找不到curl-config了。
我们应该再安装前让程序可以找到curl-config

官方文档中有说明如何设置(PYCURL_CURL_CONFIG),不懂继续看

所以我应该输入:

you-name:~$     whereis curl-config # 我们先找到curl-config在哪,如果没有的话自己去安装curl
/usr/bin/curl-config
you-name:~$     export PYCURL_CURL_CONFIG=/usr/bin/curl-config # 将其设置进临时环境变量
you-name:~$     pip install pycurl # 开始安装

错误四

your-name:~$     pip install pycurl
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting pycurl
  Downloading http://mirrors.aliyun.com/pypi/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz (214kB)
    100% |████████████████████████████████| 215kB 3.1MB/s
Installing collected packages: pycurl
  Running setup.py install for pycurl ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-aROgmt/pycurl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-record-tolFvn/install-record.txt --single-version-externally-managed --compile:
    Using /usr/bin/curl-config (libcurl 7.54.0)
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-intel-2.7
    creating build/lib.macosx-10.13-intel-2.7/curl
    copying python/curl/__init__.py -> build/lib.macosx-10.13-intel-2.7/curl
    running build_ext
    building 'pycurl' extension
    creating build/temp.macosx-10.13-intel-2.7
    creating build/temp.macosx-10.13-intel-2.7/src
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/docstrings.c -o build/temp.macosx-10.13-intel-2.7/src/docstrings.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/easy.c -o build/temp.macosx-10.13-intel-2.7/src/easy.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/easycb.c -o build/temp.macosx-10.13-intel-2.7/src/easycb.o
    src/easycb.c:215:26: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                int sockfd = PyInt_AsLong(fileno_result);
                    ~~~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/easycb.c:501:24: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            int ret_code = PyInt_AsLong(result);
                ~~~~~~~~   ^~~~~~~~~~~~~~~~~~~~
    src/easycb.c:887:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                err = ERR_peek_last_error();
                    ~ ^~~~~~~~~~~~~~~~~~~~~
    src/easycb.c:899:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
        err = ERR_peek_last_error();
            ~ ^~~~~~~~~~~~~~~~~~~~~
    4 warnings generated.
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/easyinfo.c -o build/temp.macosx-10.13-intel-2.7/src/easyinfo.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/easyopt.c -o build/temp.macosx-10.13-intel-2.7/src/easyopt.o
    src/easyopt.c:595:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                    val = PyLong_AsLong(PyListOrTuple_GetItem(httppost_option, j, which_httppost_option));
                        ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 warning generated.
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/easyperform.c -o build/temp.macosx-10.13-intel-2.7/src/easyperform.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/module.c -o build/temp.macosx-10.13-intel-2.7/src/module.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/multi.c -o build/temp.macosx-10.13-intel-2.7/src/multi.o
    src/multi.c:843: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);
                       ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
    1 warning generated.
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/oscompat.c -o build/temp.macosx-10.13-intel-2.7/src/oscompat.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/pythoncompat.c -o build/temp.macosx-10.13-intel-2.7/src/pythoncompat.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/share.c -o build/temp.macosx-10.13-intel-2.7/src/share.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/stringcompat.c -o build/temp.macosx-10.13-intel-2.7/src/stringcompat.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/threadsupport.c -o build/temp.macosx-10.13-intel-2.7/src/threadsupport.o
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -I/usr/local/Cellar/openssl/1.0.2o_2/include -arch i386 -arch x86_64 -pipe -DPYCURL_VERSION="7.43.0.2" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/util.c -o build/temp.macosx-10.13-intel-2.7/src/util.o
    cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. -L/usr/local/Cellar/openssl/1.0.2o_2/lib -I/usr/local/Cellar/openssl/1.0.2o_2/include build/temp.macosx-10.13-intel-2.7/src/docstrings.o build/temp.macosx-10.13-intel-2.7/src/easy.o build/temp.macosx-10.13-intel-2.7/src/easycb.o build/temp.macosx-10.13-intel-2.7/src/easyinfo.o build/temp.macosx-10.13-intel-2.7/src/easyopt.o build/temp.macosx-10.13-intel-2.7/src/easyperform.o build/temp.macosx-10.13-intel-2.7/src/module.o build/temp.macosx-10.13-intel-2.7/src/multi.o build/temp.macosx-10.13-intel-2.7/src/oscompat.o build/temp.macosx-10.13-intel-2.7/src/pythoncompat.o build/temp.macosx-10.13-intel-2.7/src/share.o build/temp.macosx-10.13-intel-2.7/src/stringcompat.o build/temp.macosx-10.13-intel-2.7/src/threadsupport.o build/temp.macosx-10.13-intel-2.7/src/util.o -lcrypto -lssl -lcurl -o build/lib.macosx-10.13-intel-2.7/pycurl.so
    ld: warning: ignoring file /usr/local/Cellar/openssl/1.0.2o_2/lib/libcrypto.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/Cellar/openssl/1.0.2o_2/lib/libcrypto.dylib
    ld: warning: ignoring file /usr/local/Cellar/openssl/1.0.2o_2/lib/libssl.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/Cellar/openssl/1.0.2o_2/lib/libssl.dylib
    running install_lib
    creating /Library/Python/2.7/site-packages/curl
    error: could not create '/Library/Python/2.7/site-packages/curl': Permission denied

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-aROgmt/pycurl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-record-tolFvn/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qv/5lbgb8nd7j1_1v_c5hf0h8fm0000gn/T/pip-install-aROgmt/pycurl/

可以看见Permission denied的字眼,切换root用户执行就好了

最后

对你有帮助的资料:
https://www.cnblogs.com/zhzhang/p/8623718.html
https://blog.csdn.net/nellyp/article/details/80110599
https://blog.csdn.net/kriszhang/article/details/74833486

    原文作者:庸碌无为
    原文地址: https://www.jianshu.com/p/61fd0c16aef4
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞