如何在 OSX 10.7 上安装 psycopg2

发布于 2024-12-22 01:50:39 字数 3764 浏览 0 评论 0原文

我按照以下步骤操作:

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

也来自这个 OSX Lion 上的 psycopg2 安装问题 我开始知道我可以通过 macports 安装 psycopg2 但从此 http://www.macports.org/install.php 知道我再次需要 xcode。

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

![macports 安装图像][1]

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

I followed the following procedure:

1) $ sudo pip install psycopg2

This gave me the following error

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) Then I searched on web for installing llvm-gcc-4.2 and from this http://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-llvm-gcc/_index.html
got to know that I need to install Xcode

Also from this psycopg2 installation problem on OSX Lion I came to know that I can install psycopg2 via macports but then from this http://www.macports.org/install.php came to know that I need xcode again.

3) Finally I tried to install Xcode from apple store, it downloaded 1.6 gb file and after that says that it is now installed on my system. Here is the screenshot of the same

![macports installed image][1]

4) And then I tried to install macports via the dmg file available at http://www.macports.org/install.php but it says that xcode not yet installed on my system. Here is the screenshot of the same. ![when trying to install macport, xcode not installed message appears][2]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

扮仙女 2024-12-29 01:50:39

这里还缺少一个额外的细节。在 Xcode 4.3 及更高版本中,您需要作为单独的步骤安装命令行工具。您需要执行此操作,以便脚本启动对 llvm-gcc-4.2 命令行版本的调用

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

There is an additional detail missing here. In Xcode 4.3 and higher you need to install the command-line tools as a separate step. You need to do this in order for the script to initiate the call to the command line version of llvm-gcc-4.2

Go to Xcode > Preferences > Downloads > Command Line Tools Install.

颜漓半夏 2024-12-29 01:50:39

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

The problem most likely is that you only downloaded the Xcode INSTALLER from the App Store. You now need to run the installer to install Xcode.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文