加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

当PostgreSQL未安装在开发系统上时,将psycopg2安装到virtualenv

发布时间:2020-12-13 16:52:32 所属栏目:百科 来源:网络整理
导读:当我的开发系统上没有安装PostgreSQL时,是否可以将 psycopg2 安装到virtualenv中?MacBook Pro with OS X 10.6? 当我运行pip install psycopg2从我的virtualenv,我收到如下所示的错误。 我试图连接到使用Django的服务器上的遗留数据库,我不想在我的开发
当我的开发系统上没有安装PostgreSQL时,是否可以将 psycopg2安装到virtualenv中?MacBook Pro with OS X 10.6?

当我运行pip install psycopg2从我的virtualenv,我收到如下所示的错误。

我试图连接到使用Django的服务器上的遗留数据库,我不想在我的开发系统上安装PostgreSQL如果可能的话。

为什么不安装PostgreSQL?

我收到一个错误,当使用homebrew安装PostgreSQL。我有Xcode4,只有Xcode4安装在我的MacBook Pro,我认为它与缺少gcc 4.0相关。但是,这是另一个StackOverflow问题的问题。

更新2011年4月12日上午8:37:我仍然想知道如果这是可能的,而不是在我的MacBook Pro上安装PostgreSQL。但是,我运行brew更新和强制重新安装ossp-uuid与brew install –force ossp-uuid和现在brew安装postgresql工作。与PostgreSQL成功安装,我能够安装psycopg2从我的virtualenv。

错误pip安装psycopg2

$ pip install psycopg2
Downloading/unpacking psycopg2
  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

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
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/matthew/.pip/pip.log

初步研究

以下是我作为初步研究阅读的文章:

> Installing psycopg2 to use Django with PostgreSQL on OS X
> Installing psycopg2 on OS X
> Using psycopg2 with virtualenv on Ubuntu JauntyLucid
> Postgres,psycopg2,virtualenv install hints

psycopg依赖于pg_config命令,如果你没有它,你不能安装psycopg。

如果系统安装是一个问题,为什么不尝试编译PostgreSQL和包括生成的bin文件在$ PATH?喜欢:

export PATH=/path/to/compiled/postgresql/bin:"$PATH"
pip install psycopg2

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读