【问题标题】:how to install psycopg2 on OSX 10.7如何在 OSX 10.7 上安装 psycopg2
【发布时间】:2011-12-18 23:40:43
【问题描述】:

我遵循以下程序:

1)$ sudo pip install psycopg2

这给了我以下错误

Downloading/unpacking psycopg2
  Running setup.py egg_info for package psycopg2

    no previously-included directories found matching 'doc/src/_build'
Installing collected packages: psycopg2
  Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.3 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090004 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.7-intel-2.7/psycopg/psycopgmodule.o
    unable to execute llvm-gcc-4.2: No such file or directory
    error: command 'llvm-gcc-4.2' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/Users/boltellinfomedia/mukul/mukul/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-8NaS72-record/install-record.txt:
    running install

running build

running build_py

running build_ext

building 'psycopg2._psycopg' extension

llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.3 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090004 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.7-intel-2.7/psycopg/psycopgmodule.o

unable to execute llvm-gcc-4.2: No such file or directory

error: command 'llvm-gcc-4.2' failed with exit status 1

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/Users/boltellinfomedia/mukul/mukul/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-8NaS72-record/install-record.txt failed with error code 1
Storing complete log in /Users/boltellinfomedia/.pip/pip.log

2) 然后我在网上搜索安装 llvm-gcc-4.2 并从此 http://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-llvm-gcc/_index.html 知道我需要安装 Xcode

也从这个psycopg2 installation problem on OSX Lion 我知道我可以通过macports 安装psycopg2,但是从这个http://www.macports.org/install.php 知道我再次需要xcode。

3) 最后我尝试从苹果商店安装 Xcode,它下载了 1.6 GB 的文件,然后说它现在安装在我的系统上。这是相同的屏幕截图

![macports 安装镜像][1]

4) 然后我尝试通过http://www.macports.org/install.php 提供的 dmg 文件安装 macports,但它说我的系统上尚未安装 xcode。这是相同的屏幕截图。 ![尝试安装macport时,出现xcode not installed消息][2]

【问题讨论】:

  • 我无法添加图像,因为我没有 10 个声望点。一旦我获得它们,我将添加图像。

标签: python macos postgresql psycopg2


【解决方案1】:

这里缺少一个额外的细节。在 Xcode 4.3 及更高版本中,您需要单独安装命令行工具。您需要这样做才能让脚本启动对命令行版本 llvm-gcc-4.2 的调用

转到 Xcode > 首选项 > 下载 > 命令行工具安装。

【讨论】:

  • 谢谢。这帮助我解决了在升级到 Mountain Lion 后重新安装 Python 2.7 时“无法执行 clang”的问题。
  • 我已经花了 2 个小时来编辑我的 bash 并尝试各种技巧。这解决了它。
【解决方案2】:

问题很可能是您只从 App Store 下载了 Xcode INSTALLER。您现在需要运行安装程序来安装 Xcode。

【讨论】:

  • 感谢您抽出宝贵的时间。我无法附上图片,否则我会向你展示苹果商店说安装了 xcode。没有重新安装或卸载的链接,我该如何调试这个问题。
  • 如你所说,我发现安装程序文件只是下载并没有安装。我终于能够找到安装它的链接。虽然这很奇怪,即使应用程序没有安装,苹果商店却显示它已安装。终于在你的帮助下一切都解决了。
猜你喜欢
  • 1970-01-01
  • 2013-01-08
  • 2012-04-21
  • 1970-01-01
  • 2022-06-30
  • 1970-01-01
  • 1970-01-01
  • 2011-07-22
  • 2019-07-11
相关资源
最近更新 更多