如何在似乎没有 gcc 访问权限的 virtualenv 中安装 psycopg2?
我正在尝试在 virtualenv 中安装 psycopg2,但似乎我无权访问 gcc。
有没有办法从 virtualenv 内部激活 gcc?如果没有,是否还有其他与 PostgreSQL 兼容但不使用 gcc 的库?
我尝试在 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
更新:
我发现我尝试安装 psycopg2 的计算机没有 PostgreSQL。网络托管公司在另一台服务器上安装了 PostgreSQL。在这种情况下可以做什么呢?
I'm trying to install psycopg2 in a virtualenv but it seems that I don't have access to gcc.
Is there a way to activate gcc from inside the virtualenv? If not, is there any other library that works with PostgreSQL that does not use gcc?
My attempt to install psycopg2 at A2hosting.com gives me this error:
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. The webhosting company has PostgreSQL installed on another server. What can be done in a situation like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要 PostgreSQL,您需要 PostgreSQL 客户端库和开发文件。您可以尝试要求主机安装它们,或者如果失败,您可以在类似的平台上构建它并手动复制软件包。
You don't need PostgreSQL, you need the PostgreSQL client libraries and development files. 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.