views:

342

answers:

3

I'm running Python 2.6.4 on Mac Snow Leopard. I installed pycurl using:

sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl==7.16.2.1

The installation completes with no issues and says pycurl is installed in subsequent installation attempts. However, when I try to "import pycurl" in a script, I get a message that pycurl isn't found. I'm not sure what else to do to fix this.

+1  A: 

I guess you have 2 different versions of python, you can find out by running command which python

S.Mark
+2  A: 

I would suspect you have 2 versions of python on your system. How about removing easy install and reinstalling it.

Remove the current easy install script by typing which easy_install and then rm [easy install full path].

To install easy install

wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py

Then, try your command again:

sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl==7.16.2.1
Gattster
You were definitely on the right track. That *was* the problem. easy_install was from the native 2.4 version of Python that came with the OS. It was installing pycurl to that version. So I followed your steps and easy_install is definitely now running under 2.6.4. However, I now have a different problem.Its trying to build using the 10.4 XCode SDK, which I don't believe I installed when I setup XCode. This is the error: from src/pycurl.c:35:/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
Geuis
I think my next step is to try and install the older SDK and trying the build again.
Geuis
I installed the 10.4 SDK on one computer to solve this problem and regretted it. I never put the 10.4 SDK on the current machine I'm working on, and just tested and the install worked for me using the easy_install command you gave.Sorry I'm not of more help in diagnosing the problem.
Gattster
A: 

If you have installed Python 2.6.4 using the python.org OS X installer, you need to install the optional 10.4u SDK from the 10.6 Xcode mpkg to install any python packages that include C extension modules.

Ned Deily