草庐IT

postgresql_psycopg

全部标签

python - 错误 : command 'gcc' failed with exit status when installing psycopg2

我需要为openerp安装过程安装psycopg2,但我总是遇到这个错误。我已经使用过pip和easy_install并且我的gcc是最新版本。我真的需要你的帮助来解决我的问题。这是我使用easy_install的完整错误:[root@server01~]#easy_installpsycopg2Searchingforpsycopg2Readinghttp://pypi.python.org/simple/psycopg2/Readinghttp://initd.org/psycopg/Readinghttp://initd.org/projects/psycopg2Bestmatc

python - 在 CentOS 上安装 psycopg2 时遇到问题

我正在尝试在CentOS上安装psycopg2,我遵循了tutorial上的所有内容从“使用它:安装Python2.6”一直到导入psycopg2,但是当我尝试导入时,出现以下错误:Traceback(mostrecentcalllast):File"",line1,inFile"/opt/python2.6/lib/python2.6/site-packages/psycopg2/__init__.py",line69,infrom_psycopgimportBINARY,NUMBER,STRING,DATETIME,ROWIDImportError:libpq.so.5:canno

python - "Failed building wheel for psycopg2"- MacOSX 使用 virtualenv 和 pip

我第一次尝试与其他几个人一起创建一个网站,但在尝试使用Django/Python/VirtualEnv时遇到了一个奇怪的错误。我已经为其他操作系统(例如Ubuntu)找到了此问题的解决方案,但找不到适用于Mac的任何好的解决方案。这是正在运行的相关代码:virtualenv-ppython3venvsourcevenv/bin/activatepipinstall-rrequirements.txt运行该block后,我收到以下错误:AssertionErrorFailedbuildingwheelfordjango-toolbeltRunningsetup.pybdist_wheel

python - Postgres SSL SYSCALL 错误 : EOF detected with python and psycopg

在python2.7中使用psycopg2包,我不断收到标题错误:psycopg2.DatabaseError:SSLSYSCALLerror:EOFdetected仅当我将WHEREcolumnLIKE''%X%''子句添加到我的pgrouting查询时才会发生这种情况。一个例子:SELECTid1asnode,costFROMPGR_Driving_Distance('SELECTid,source,target,costFROMedge_tableWHEREcostISNOTNULLandcolumnLIKE''%x%''',1,10,false,false)互联网上的帖子直观地

python - 使用 Psycopg2 插入 Python 字典

将具有许多键的Python字典插入Postgres数据库而不必枚举所有键的最佳方法是什么?我想做一些类似...song=dict()song['title']='song1'song['artist']='artist1'...cursor.execute('INSERTINTOsong_table(song.keys())VALUES(song)') 最佳答案 frompsycopg2.extensionsimportAsIssong={'title':'song1','artist':'artist1'}columns=song

python - 使用带有 psycopg2 的二进制 COPY 表 FROM

我有数千万行要从多维数组文件传输到PostgreSQL数据库。我的工具是Python和psycopg2。批量插入数据的最有效方法是使用copy_from.但是,我的数据大多是32位float(real或float4),所以我宁愿不从real→text→real转换。这是一个示例数据库DDL:CREATETABLEnum_data(idserialPRIMARYKEYNOTNULL,nodeintegerNOTNULL,tssmallintNOTNULL,val1real,val2doubleprecision);这是我使用Python使用字符串(文本)的地方:#Justonerowof

python - 如何使用 Python 通过 SSL 连接到远程 PostgreSQL 数据库

我想通过Python连接到远程PostgreSQL数据库来做一些基本的数据分析。该数据库需要SSL(verify-ca),以及三个文件(我有):服务器根证书文件客户端证书文件客户端key文件我无法找到描述如何使用Python建立这种连接的教程。任何帮助表示赞赏。 最佳答案 使用psycopg2模块。您需要在连接字符串中使用ssl选项,或者将它们添加为关键字参数:importpsycopg2conn=psycopg2.connect(dbname='yourdb',user='dbuser',password='abcd1234',h

Python PostgreSQL 模块。哪个最好?

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题吗?更新问题,以便editingthispost提供事实和引用来回答它.关闭去年。Improvethisquestion我见过许多用于python的postgresql模块,例如pygresql、pypgsql、psyco。它们中的大多数都符合PythonDBAPI2.0,有些不再积极开发。你推荐哪个模块?为什么? 最佳答案 psycopg2似乎是最受欢迎的。我从来没有遇到过任何麻烦。实际上,PostgreSQL也有一个纯Python接口(interfac

python - 在 MacOS 10.9.5 上安装 Psycopg2 时出错

我正在尝试在我的Macbook上安装Psycopg2,但出现错误。我在StackOverflow上发现了很多相同的问题,但似乎没有答案。我正在使用:操作系统:MacOS10.9.5Python版本:3.4.3我的错误代码是:Runningsetup.pyegg_infoforpackagepsycopg2Error:pg_configexecutablenotfound.Pleaseaddthedirectorycontainingpg_configtothePATHorspecifythefullexecutablepathwiththeoption:pythonsetup.pybu

python - 无法在 Mac OS X 10.7 上的 virtualenv 中使用 pip 安装 psycopg2

我正在按照Heroku的教程部署Django应用程序:http://devcenter.heroku.com/articles/django#prerequisites.在我进入这部分之前一切正常:$pipinstallDjangopsycopg2我可以自己安装Django,但问题是使用psycopg2。我不断收到此错误:ld:librarynotfoundfor-lpqcollect2:ldreturned1exitstatusld:librarynotfoundfor-lpqcollect2:ldreturned1exitstatuslipo:can'topeninputfile: