在Mac OS X上安装libpq-dev [英] Install libpq-dev on Mac OS X

查看:2022
本文介绍了在Mac OS X上安装libpq-dev的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在本地的Mac OS X上使用Postgresql后端运行Django。我已经使用pip安装了Django:

  sudo pip安装Django 

我已经安装Postgresql与其中一个二进制安装程序 here



但是当我尝试安装psycopg2我得到一个错误(粘贴在下面),它找不到pg_config。



这个问题似乎我应该安装 libpq-dev 但我不知道如何。



我已经尝试使用MacPorts安装 libpqxx ,但没有做任何事情。



如何安装libpg-dev?还是还有其他的东西我失踪了?

  henrietta:〜$ pip install psycopg2 
下载/打包psycopg2
下载psycopg2-2.4.5.tar.gz(719Kb):719Kb下载
运行setup.py egg_info为软件包psycopg2
错误:pg_config可执行文件未找到。

请将包含pg_config的目录添加到PATH
中,或者使用以下选项指定完整的可执行路径:

python setup.py build_ext --pg-config / path / to / pg_config build ...

或与setup.cfg中的pg_config选项。
从命令完成输出python setup.py egg_info:
运行egg_info

创建pip-egg-info / psycopg2.egg-info

写入点-egg-info / psycopg2.egg-info / PKG-INFO

将顶级名称写入pip-egg-info / psycopg2.egg-info / top_level.txt

将dependency_links写入pip-egg-info / psycopg2.egg-info / dependency_links.txt

写清单文件'pip-egg-info / psycopg2.egg-info / SOURCES.txt'

警告:manifest_maker:未找到标准文件'-c'

错误:找不到pg_config可执行文件。



请将包含pg_config的目录添加到PATH

中,或者使用选项指定完整的可执行路径:



python setup.py build_ext --pg-config / path / to / pg_config build ...



或与pg_config选项在'setup.cfg'中。

----------------------------------------
命令python setup.py egg_info失败,出现错误代码1
存储完整的登录/Users/thomas/.pip/pip.log


解决方案

所以我结束了以下建议:



http://blog.jonypawks.net/2008/06/20/installing -psycopg2-on-os-x /



原来我没有安装 pg-config ,但是我不得不掏腰包去找一下。一旦我把路线中的一切都包括在内,一切都在游泳。以下是该链接的片段:

  PATH = $ PATH:/Library/PostgresPlus/8.3/bin/ sudo easy_install psycopg2 

我使用 pip 而不是 easy_install 和我的PostgreSQL安装目录略有不同,但这是要点。


I'm trying to run Django with a Postgresql backend on my local Mac OS X. I've installed Django using pip:

sudo pip install Django

I've installed Postgresql with one of the binary installers here.

But when I try to install psycopg2 I get an error (pasted below) that it can't find pg_config.

From this question it seems like I should install libpq-dev but I'm not sure how.

I've tried installing libpqxx with MacPorts, but that hasn't done anything.

How do I get libpg-dev installed? Or is there something else I'm missing?

henrietta:~ $ pip install psycopg2
Downloading/unpacking psycopg2
  Downloading psycopg2-2.4.5.tar.gz (719Kb): 719Kb downloaded
  Running setup.py egg_info for package psycopg2
    Error: pg_config executable not found.

    Please add the directory containing pg_config to the PATH
    or specify the full executable path with the option:

        python setup.py build_ext --pg-config /path/to/pg_config build ...

    or with the pg_config option in 'setup.cfg'.
    Complete output from command python setup.py egg_info:
    running egg_info

creating pip-egg-info/psycopg2.egg-info

writing pip-egg-info/psycopg2.egg-info/PKG-INFO

writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt

writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt

writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found

Error: pg_config executable not found.



Please add the directory containing pg_config to the PATH

or specify the full executable path with the option:



    python setup.py build_ext --pg-config /path/to/pg_config build ...



or with the pg_config option in 'setup.cfg'.

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/thomas/.pip/pip.log

解决方案

So I ended up following the advice here:

http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/

Turns out I did have pg-config installed, but I had to dig around to find it a bit. Once I included that in the path, everything worked swimmingly. Here's the snippet from that link:

PATH=$PATH:/Library/PostgresPlus/8.3/bin/ sudo easy_install psycopg2

I used pip instead of easy_install and my PostgreSQL installation directory was slightly different, but that's the gist.

这篇关于在Mac OS X上安装libpq-dev的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆