1

I'm trying to install PyCurl in my local environment which has python 2.7 and gcc-4.2 on OS X 10.7 Lion. I've tried doing this based on this answer Error installing PyCurl:

sudo env ARCHFLAGS="-arch x86_64" pip install pycurl

Which fails because I have gcc-4.2 installed via Xcode:

error: command 'gcc-4.0' failed with exit status 1

I've also tried downloading the source and building a setup.py (I modified this based on Problem trying to install PyCurl on Mac Snow Leopard):

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -DHAVE_CURL_SSL=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/pycurl.c

This results in the same error as above. I have verified that I do indeed have gcc-4.2 and that it is linked to my /usr/bin.

I'm thinking that it will work if I compile it correctly so that it knows to use gcc-4.2 when installing instead of gcc-4.0. However, I don't know how to do this and have not found something to explain passing an argument to use a particular gcc. I want to avoid overriding system defaults if possible.

Community
  • 1
  • 1
ender
  • 245
  • 4
  • 12

1 Answers1

1

Chances are you have a 32-bit-only Python 2.7 installed on your system (possibly downloaded from python.org) which was built with gcc-4.0 and includes a PPC universal variant. Building C extension modules with these Pythons is very problematic with Xcode 4 installed (the default for 10.7 and optional for 10.6) because gcc-4.0 and PPC support have both been removed. The easiest and best long-term solution is to install a 64-bit/32-bit Python build (see the python.org download page for current releases) or simply use the Apple-supplied Python 2.7.1 (/usr/bin/python2.7) in 10.7.

Ned Deily
  • 83,389
  • 16
  • 128
  • 151
  • I thought I was using the Apple supplied install of python in Lion. When I do which python it tells me the path is /Library/Frameworks/Python.framework/Versions/2.7/bin/python not /usr/bin/python2.7 – ender Oct 11 '11 at 20:41
  • No, the Apple-supplied Pythons are all in `/System/Library/Frameworks/Python.framework`. Your shell path has probably been modified to put that `/Library.../2.7/bin/python` directory first. The python.org installers do that by default. If you want to, you can undo that by modifying the appropriate shell startup file, most likely `.bash_profile`. Look for and compare it with `.bash_profile.pysave`. – Ned Deily Oct 11 '11 at 21:58
  • Thanks, I modified my .bash_profile to use the built in python and was able to successfully install pycurl! – ender Oct 11 '11 at 23:50