简体   繁体   English

如何在似乎没有gcc访问权限的virtualenv中安装psycopg2?

[英]How do I install psycopg2 in a virtualenv that seems to not have gcc access?

I'm trying to install psycopg2 in a virtualenv but it seems that I don't have access to gcc. 我正在尝试在virtualenv中安装psycopg2,但看来我无权访问gcc。

Is there a way to activate gcc from inside the virtualenv? 有没有办法从virtualenv内部激活gcc? If not, is there any other library that works with PostgreSQL that does not use gcc? 如果不是,是否还有其他不使用gcc的与PostgreSQL兼容的库?

My attempt to install psycopg2 at A2hosting.com gives me this error: 我在A2hosting.com上安装psycopg2的尝试给了我这个错误:

running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.4
creating build/lib.linux-x86_64-2.4/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-2.4/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-2.4/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-2.4/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-2.4/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-2.4/psycopg2
copying lib/psycopg1.py -> build/lib.linux-x86_64-2.4/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-2.4/psycopg2
creating build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/types_extras.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/types_basic.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_dates.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/bugX000.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_copy.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_async.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_notify.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/extras_dictcursor.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_lobject.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_connection.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_green.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/bug_gc.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/__init__.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_quote.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/testutils.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/dbapi20.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_cursor.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_cancel.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/test_transaction.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
copying tests/testconfig.py -> build/lib.linux-x86_64-2.4/psycopg2/tests
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-2.4
creating build/temp.linux-x86_64-2.4/psycopg
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080309 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.4 -I. -I/usr/include -I/usr/include/pgsql/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.4/psycopg/psycopgmodule.o -Wdeclaration-after-statement
unable to execute gcc: Permission denied
error: command 'gcc' failed with exit status 1

UPDATE: 更新:

I've discovered that the machine on which I'm trying to install psycopg2 doesn't have PostgreSQL. 我发现我要在其上安装psycopg2的计算机没有PostgreSQL。 The webhosting company has PostgreSQL installed on another server. 该虚拟主机公司在另一台服务器上安装了PostgreSQL。 What can be done in a situation like this? 在这种情况下该怎么办?

You don't need PostgreSQL, you need the PostgreSQL client libraries and development files. 您不需要PostgreSQL,您需要PostgreSQL客户端库和开发文件。 You can try asking the host to install them, or failing that you can build it on a similar platform and copy the package manually. 您可以尝试要求主机进行安装,否则,您可以在类似的平台上构建它并手动复制该软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM