pycurl install :( already have min. libcurl versio

2019-05-15 04:43发布

问题:

I'm running python 2.6 on an Intel Mac OS X 10.5

I'm trying to install pycurl 7.16.2.1 (as recommended here http://curl.haxx.se/mail/curlpython-2009-03/0009.html), but for some reason, the installation sees my libcurl 7.16.3, yet it still insist I install 7.16.2 or greater (doesn't 7.16.3 satisfy that?)

Here's the error output:

Running pycurl-7.16.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-3emZIB/pycurl-7.16.2.1/egg-dist-tmp-K10rbP
Using curl-config (libcurl 7.16.3)
src/pycurl.c:54:4:src/pycurl.c:54:4: error: #error "Need libcurl version 7.16.2 or greater to compile pycurl."
 error: #error "Need libcurl version 7.16.2 or greater to compile pycurl."

To be certain curl-config --version yields libcurl 7.16.3

Any advice? Should I upgrade libcurl, or stick with the factory default lib?

== added more details after response ==

AFAIK the python I have is factory default (I didn't get it myself from python.org)

Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) 
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin

And this is my curl version. Looks misleading because I'm using an Intel Macbook, not PPC.

curl 7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
Protocols: tftp ftp telnet dict ldap http file https ftps 
Features: GSS-Negotiate IPv6 Largefile NTLM SSL libz 

I'll take whichever pycurl works with my existing python interpreter

I do have ports:

sudo port -u install py26-pycurl
Error: Port py26-pycurl not found

回答1:

If you are using the python.org Python 2.6, it is built using the 10.4 SDK so as to be able to run on multiple versions of OS X. In that case, the pycurl build is likely trying to link against the 10.4 version of libcurl, which appears to be 7.13.1. The thread you link to is talking about using the 10.5 Apple-supplied Python 2.5 which is built using 10.5 libraries and, with that, pycurl 7.16.2.1 does seem to build and install correctly.

You can try to manually install pycurl; there is a documented --curl-config argument to its setup.py which allows you to specify the path to the curl-config to use. Unfortunately, that does not seem to work with /usr/bin/curl-config; the proper include files directories are not being added. Short of hacking the setup.py file, a better approach is to install a newer libcurl and use the latest pycurl. The easiest way to do that is to use MacPorts. Even easier is to install pycurl and python2.6 from MacPorts. If you don't already use MacPorts, download and install the base files. Then:

sudo port selfupdate
sudo port -u install py26-curl   #edited

The MacPorts python2.6 will be at /opt/local/bin/python2.6.

If you'd rather stick with the python2.6 you've installed, install the curl package:

sudo port selfupdate
sudo port -u install curl

Then manually install pycurl using something like:

curl http://pycurl.sourceforge.net/download/pycurl-7.19.0.tar.gz | tar xz
cd pycurl-7.19.0
python2.6 setup.py install --curl-config=/opt/local/bin/curl-config


回答2:

I got my pycurl from Sourceforge. Seems they'd have installable builds backwards and forwards that would match any "shipped with" Mac OS X configuration there is. I believe the URL is http://pycurl.sourceforge.net but don't quote me on that.

BZT