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

发布于 2024-10-25 17:12:21 字数 3406 浏览 4 评论 0原文

我正在尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

聊慰 2024-11-01 17:12:21

您不需要 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文