2

Sorry for this basic question. I am new to this and I have been pulling my hair out.

Environment:

  • Python2.7.3 + Django 1.4 + PostgreSQL 9.2.
  • OSX 10.8.2 + Xcode 4.5.1

Error:

I tried to install psycopg2 in different ways: from source, easy_install and pip. I always get the same error: unable to execute gcc-4.0: No such file or directory + error: command 'gcc-4.0' failed with exit status 1

I first did not have gcc installed so downloaded Xcode and the related developer tools. Now I have gcc-4.2. This is the version: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1

BUT psycopg2 keeps insisting on gcc-4.0, but I (now) have 4.2. At the same time, I have noticed from other Stackoverflow posts that it is possible to compile psycopg2 using gcc-4.2. And I'd rather not do one of these unsupported hacks involving Xcode3 in order to access Gcc-4.0.

My question:

Can I specify to use gcc-4.2, instead of gcc-4.0 somehow when installing psycopg2? Django + PostgreSQL are very commonly used so surely there must be a simple way to solve this? Many thanks!!

Clodoaldo Neto
  • 118,695
  • 26
  • 233
  • 260
kdeebee
  • 51
  • 4
  • Is PostgreSQL compiled with gcc-4.0 or 4.2? – Richard Huxton Oct 25 '12 at 16:24
  • @RichardHuxton I am not sure. I downloaded the 9.2.1 OSX version [here](http://www.enterprisedb.com/products-services-training/pgdownload#osx) During the installation process, it didn't mention anything about gcc either. I get the error when installing psycopg2, e.g. pip install psycopg2 . Tx!!! – kdeebee Oct 25 '12 at 16:49
  • That's probably it then. One of PostgreSQL or Python is built using gcc-4.0 so that's what it wants to build add-ons with. So long as they all use the same it shouldn't matter which. It might even be safe to just override the check, but I can't guarantee that. Oh - "pg_config" is a useful way to get some details of how your PostgreSQL setup was built. – Richard Huxton Oct 25 '12 at 17:39
  • 1
    Thanks @Richard my version of Python 2.7.3 was indeed built using gcc-4.0. and therefore it was forcing this (older) gcc version on the psycopg2 install. For the benefit of others with the same problem: upgrading my python install from a 32bit to 64bit [version] (http://stackoverflow.com/questions/1405913/how-do-i-determine-if-my-python-shell-is-executing-in-32bit-or-64bit-mode) solved it. Just updating the CC variable did not work. – kdeebee Oct 29 '12 at 13:38
  • Installing Python 2.7.3 64-bit worked for me as well. http://www.python.org/download/releases/2.7.3/ – ravishi Jan 03 '13 at 21:36

0 Answers0