设置 psycopg2(PostGreSQL/python 数据库)时遇到问题

发布于 2024-11-10 12:32:46 字数 569 浏览 2 评论 0原文

嘿,我对 Linux 还很陌生(使用 Ubuntu 11.04),所以请耐心等待。

我从 http://linux.softpedia 下载了 psycopg2 2.4.1。 com/get/Database/Database-APIs/psycopg-6404.shtml

然后我尝试运行...

python setup.py install

..虽然在目录中,但它告诉我..

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

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

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

... 我不知道如何到达 pg_config 的路径(我什至找不到它)。

感谢您的任何帮助。

Hey, I'm pretty new to linux (using Ubuntu 11.04) so bear with me here.

I downloaded psycopg2 2.4.1 from http://linux.softpedia.com/get/Database/Database-APIs/psycopg-6404.shtml

Then I try running...

python setup.py install

..While in the directory but then it tells me..

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 ...

... and I don't know how to get to the path of pg_config (and I can't even find it).

Thanks for any help.

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

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

发布评论

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

评论(2

岁月打碎记忆 2024-11-17 12:32:46

如果您找到 pg_config

find /opt /usr -name pg_config
# Take note of path
env PATH=${PATH}:/opt/local/lib/postgresql91/bin python setup.py build

或者在 PostgreSQL 安装的任何位置转储了 pg_config 文件,这里有一个简单的解决方案。

Here's an easy solution if you find your pg_config:

find /opt /usr -name pg_config
# Take note of path
env PATH=${PATH}:/opt/local/lib/postgresql91/bin python setup.py build

Or wherever your installation of PostgreSQL dumped off your pg_config file.

反话 2024-11-17 12:32:46

您可能没有安装它。我这样做了:

me@mine:~ $ pg_config
The program 'pg_config' is currently not installed.  You can install it by typing:
sudo apt-get install libpq-dev
me@mine:~ $ sudo apt-get install libpq-dev

似乎有效。

您不通过 apt-get 安装 Psychopg 有什么原因吗?因为这可能是最简单的解决方案:

sudo apt-get install python-psycopg2

仅供参考,许多 python 包都可以通过 apt-get 安装,唯一要记住的是它们通常有一个 python- 前缀-- 如 python-nltkpython-qt4-dev 等。

You probably don't have it installed. I did this:

me@mine:~ $ pg_config
The program 'pg_config' is currently not installed.  You can install it by typing:
sudo apt-get install libpq-dev
me@mine:~ $ sudo apt-get install libpq-dev

Seemed to work.

Is there a reason you aren't installing psychopg via apt-get though? Because this would probably be the easiest solution:

sudo apt-get install python-psycopg2

FYI, many python packages are installable via apt-get, and the only thing to remember is that they generally have a python- prefix -- as in python-nltk, python-qt4-dev, and so on.

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