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

macos – 在Max OSX Yosemite中尝试“pip install psycopg2”时

发布时间:2020-12-13 16:06:49 所属栏目:百科 来源:网络整理
导读:我试图在我的Django项目中使用 postgresql所以我一直在尝试安装psycopg2但是我一直遇到问题.由于我使用的是virtualenv,通过macports安装psycopg2并没有帮助.我需要找到将其作为应用程序安装在我的虚拟环境中. 这是我尝试在我的virtualenv中安装它时得到的错
我试图在我的Django项目中使用 postgresql所以我一直在尝试安装psycopg2但是我一直遇到问题.由于我使用的是virtualenv,通过macports安装psycopg2并没有帮助.我需要找到将其作为应用程序安装在我的虚拟环境中.

这是我尝试在我的virtualenv中安装它时得到的错误:

Downloading/unpacking psycopg2
Downloading psycopg2-2.5.4.tar.gz (682kB): 682kB downloaded
Running setup.py     (path:/Users/adfelix2/Documents/Hindsait_Work/Projects/nybc_pilot/build/psycopg2/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'.

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in         /Users/user/'privateinfo'/my_virtualenv/build/psycopg2
Storing debug log for failure in /Users/user/.pip/pip.log

好像我需要在pg_config中添加一个目录?但是,我无法在网上遇到任何有助于我这样做的事情.如果有人对此有一个答案,一步一步地表示非常高兴.谢谢.

解决方法

pg_config应该位于

/Library/PostgreSQL/9.3/bin/pg_config

(替换为9.3安装的Postgres版本)

只需将该目录添加到PATH环境变量中,您就可以继续前进了.

(编辑:李大同)

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

    推荐文章
      热点阅读