我在安装psycopg2时遇到问题.我尝试以下时出现以下错误pip install 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'.
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/psycopg2
Run Code Online (Sandbox Code Playgroud)
但问题pg_config实际上是在我的PATH; 它运行没有任何问题:
$ which pg_config
/usr/pgsql-9.1/bin/pg_config
Run Code Online (Sandbox Code Playgroud)
我尝试将pg_config路径添加到该setup.cfg文件并使用我从其网站(http://initd.org/psycopg/)下载的源文件构建它,我收到以下错误消息!
Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'
Run Code Online (Sandbox Code Playgroud)
但实际上它就是!!!
我对这些错误感到困惑.有人可以帮忙吗?
顺便说一句,我 …
我正在使用virtualenv,我需要安装"psycopg2".
我做了以下事情:
pip install http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
Run Code Online (Sandbox Code Playgroud)
我有以下消息:
Downloading/unpacking http://pypi.python.org/packages/source/p/psycopg2/psycopg2
-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
Downloading psycopg2-2.4.tar.gz (607Kb): 607Kb downloaded
Running setup.py egg_info for package from http://pypi.python.org/packages/sou
rce/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
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 …Run Code Online (Sandbox Code Playgroud) 我正在学习如何将 Postgres 与 Python (sqlalchemy) 结合使用。我安装时卡住了psycopg2。我有以下错误:
pg_config executable not found error
我知道这是一个非常常见的错误,并且已经有很多关于此问题的答案,但我找不到任何可以帮助我解决问题的内容。
我特别不明白这个答案:
通过附加以下内容将 Postgres 的路径添加到您的 .profile 文件中:
PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
这是什么意思 ?我到底应该做什么?
我也尝试进入which -a pg_config我的终端,但没有任何反应。
多谢 !
我现在干净安装了Django v1.11.10.当我运行python manage.py runserver一切正常.但是当我尝试连接到Postgres数据库时,我安装了包pip install psycopg2,修改了DATABASESvaribale,在运行runserver命令后它失败并Illegal instruction出现错误:
Performing system checks...
System check identified no issues (0 silenced).
Illegal instruction: 4
Run Code Online (Sandbox Code Playgroud)
它是什么?如何获取日志错误?我使用Mac OS 10.11.6,PostgresApp(尝试在v9和v10服务器上检查错误源).Python 3.6.4(通过virtualenv).
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mydb',
'USER': 'sirjay',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
}
Run Code Online (Sandbox Code Playgroud)
如果我设置NAME或USER不正确,或者即使我关闭Postgres.app服务器,错误也是一样的.这就像Django没有看到Postgres.但随着phpPgAdmin我可以连接到Postgres服务器.