【发布时间】:2022-01-04 21:35:56
【问题描述】:
我正在尝试在我刚刚购买的新 cPanel 托管服务器上使用 PostgreSQL 设置 Python / Flask 应用程序。
我已经设置了一个 virtualenv 并设法安装了我的所有依赖项
pip install -r requirements.txt
我无法安装 psycopg2,因此一直在尝试安装 psycopg2-binary,我相信这应该可以从我在其他帖子中阅读的内容中获得。
这是输出的 sn-p:
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/seasmuyr/virtualenv/seasonwork_live/3.8/bin/python3.8_bin -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5z014r2g/psycopg2-binary_bda4b7c8d43e4a26bf92e27771da2a93/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5z014r2g/psycopg2-binary_bda4b7c8d43e4a26bf92e27771da2a93/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-gq6h8obk/install-record.txt --single-version-externally-managed --compile --install-headers /home/seasmuyr/virtualenv/seasonwork_live/3.8/include/site/python3.8/psycopg2-binary Check the logs for full command output.
我已通过 Namecheap 提交了一张票,但我不确定他们是否能够在此问题上提供很多支持。在解决此问题并让 psycopg2 为我的 PostgreSQL 数据库运行时,任何帮助将不胜感激。
【问题讨论】:
-
最好的猜测是主机上的操作系统和芯片架构与psycopg2-binary 此处的任何二进制选项都不匹配,因此安装程序正在回退到从源代码构建。
-
我认为问题在于我在从源代码构建时没有访问 gcc 的权限?
-
也许是这样,但
psycopg2-binary的重点是您不需要编译。 -
我认为问题主要在于我在共享服务器上没有 root。 Namecheap 支持将尝试为我安装模块,希望这能解决问题。
标签: python linux postgresql flask psycopg2