如何在MACOSX 10.11.6上构建PyCurl而不会出现错误

时间:2017-04-19 21:05:58

标签: macos curl pycurl

我正在尝试针对libcurl(7.53.1)的版本构建Pycurl但没有成功。

我在MACOSX El Capitan v10.11.6上。

此时我甚至不确定我是否与OpenSSL保持一致。我可能需要确保正确安装OpenSSL并使用OpenSSL构建Curl。最后使用适当的Curl构建Pycurl。

我已经在网上跟踪了几首曲目,但没有一条能让我到达我需要的位置。

解决此构建问题的最佳选择是什么?

日志:

users-MBP-2:~ mickael$ sudo easy_install pycurl 
Password:
Searching for pycurl
Reading https://pypi.python.org/simple/pycurl/ Best match: pycurl 7.43.0
Downloading https://pypi.python.org/packages/12/3f/557356b60d8e59a1cce62ffc07ecc03e4f8a202c86adae34d8958262 81fb/pycurl-7.43.0.tar.gz#md5=c94bdba01da6004fa38325e9bd6b9760
Processing pycurl-7.43.0.tar.gz
Writing /tmp/easy_install-tmm5sV/pycurl-7.43.0/setup.cfg
Running pycurl-7.43.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-tmm5sV/pycurl-7.43.0/egg-dist- tmp-Yj_ArM
Using curl-config (libcurl 7.53.1)
warning: no files found matching 'src/Makefile'
In file included from src/docstrings.c:4:
In file included from src/pycurl.h:32:
In file included from /usr/local/Cellar/curl/7.53.1/include/curl/curl.h:39: /usr/local/Cellar/curl/7.53.1/include/curl/curlrules.h:143:6: error: '__curl_rule_01__' declared as an array with a negative
size
[CurlchkszEQ(long, CURL_SIZEOF_LONG)];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/Cellar/curl/7.53.1/include/curl/curlrules.h:132:27: note: expanded from macro 'CurlchkszEQ' #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/curl/7.53.1/include/curl/curlrules.h:153:6: error: '__curl_rule_02__' declared as an array with a negative
size
[CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/Cellar/curl/7.53.1/include/curl/curlrules.h:132:27: note: expanded from macro 'CurlchkszEQ' #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
^~~~~~~~~~~~~~~~~~~~~~~ In file included from src/docstrings.c:4:
src/pycurl.h:190:5: warning: "libcurl was compiled with SSL support, but configure could not determine
which " "library was
used; thus no SSL crypto locking callbacks will be set, which may "
requests" [-W#warnings]
# warning \ ^
1 warning and 2 errors generated.
error: Setup script exited with error: command 'cc' failed with exit status 1
"cause random crashes on SSL

1 个答案:

答案 0 :(得分:1)

好的,构建Pycurl肯定存在一些挑战。以下是我采取的步骤:

  1. 确保已安装OpenSSL(如果不使用Brew:brew install openssl)。

  2. 使用OpenSSL重建Curl,请记住在MacOsX / El Capitan上默认情况下不使用OpenSSL构建Curl,而是使用SecureTransport。 (尝试:brew install --force curl --with-openssl)

  3. 用“pip”重建Pycurl。我用pip获得了成功,但没有使用easy_install。 (尝试:sudo env ARCHFLAGS =“ - arch x86_64”LDFLAGS =“ - L / usr / local / opt / openssl / lib”pip install pycurl)

  4. Pycurl安装在:/Library/Python/2.7/site-packages/pycurl.so

    安装的版本是:pycurl-7.43.0