我在使用 psycopg2 的 heroku 中部署了我的网站,当我升级版本 2.8.6 --> 2.9.1 和更高版本时,它会抛出一个错误 database connection isn't set to UTC
。
当我尝试从我的 requirements.txt 安装包含 psycopg2==2.8.6 的包(在 Windows 中使用 python virtualenv)时,它会抛出以下错误
Using cached psycopg2-2.8.6.tar.gz (383 kB)
ERROR: Command errored out with exit status 1:
command: 'A:\Projects\django\tmp_env\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Amar K\\AppData\\Local\\Temp\\pip-install-ss0ajkyw\\psycopg2_60877ad816f94182b98212026f2b8d09\\setup.py'"'"'; __file__='"'"'C:\\Users\\Amar K\\AppData\\Local\\Temp\\pip-install-ss0ajkyw\\psycopg2_60877ad816f94182b98212026f2b8d09\\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'"'"'))' egg_info --egg-base 'C:\Users\Amar K\AppData\Local\Temp\pip-pip-egg-info-pwtcfhhf'
cwd: C:\Users\Amar K\AppData\Local\Temp\pip-install-ss0ajkyw\psycopg2_60877ad816f94182b98212026f2b8d09\
Complete output (23 lines):
running egg_info
creating C:\Users\Amar K\AppData\Local\Temp\pip-pip-egg-info-pwtcfhhf\psycopg2.egg-info
writing C:\Users\Amar K\AppData\Local\Temp\pip-pip-egg-info-pwtcfhhf\psycopg2.egg-info\PKG-INFO
writing dependency_links to C:\Users\Amar K\AppData\Local\Temp\pip-pip-egg-info-pwtcfhhf\psycopg2.egg-info\dependency_links.txt
writing top-level names to C:\Users\Amar K\AppData\Local\Temp\pip-pip-egg-info-pwtcfhhf\psycopg2.egg-info\top_level.txt
writing manifest file 'C:\Users\Amar K\AppData\Local\Temp\pip-pip-egg-info-pwtcfhhf\psycopg2.egg-info\SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/fd/ae/98cb7a0cbb1d748ee547b058b14604bd0e9bf285a8e0cc5d148f8a8a952e/psycopg2-2.8.6.tar.gz#sha256=fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543 (from https://pypi.org/simple/psycopg2/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement psycopg2==2.8.6 (from versions: 2.0.10, 2.0.11, 2.0.12, 2.0.13, 2.0.14, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.4, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.6, 2.6.1, 2.6.2, 2.7, 2.7.1, 2.7.2, 2.7.3, 2.7.3.1, 2.7.3.2, 2.7.4, 2.7.5, 2.7.6, 2.7.6.1, 2.7.7, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9, 2.9.1, 2.9.2, 2.9.3, 2.9.4, 2.9.5)ERROR: No matching distribution found for psycopg2==2.8.6
我的需求.txt
asgiref==3.3.4
autopep8==2.0.1
certifi==2020.12.5
cffi==1.15.1
chardet==3.0.4
charset-normalizer==2.0.12
click==8.0.1
cloudscraper==1.2.58
colorama==0.4.4
cryptography==3.4.7
defusedxml==0.7.1
diff-match-patch==20200713
dj-database-url==0.5.0
Django==3.0.7
django-environ==0.9.0
django-heroku==0.3.1
django-import-export==2.7.1
et-xmlfile==1.1.0
flake8==6.0.0
gingerit==0.8.2
googletrans==3.1.0a0
gunicorn==20.1.0
h11==0.9.0
h2==3.2.0
hpack==3.0.0
hstspreload==2020.12.22
httpcore==0.9.1
httpx==0.13.3
hyperframe==5.2.0
idna==2.10
joblib==1.1.1
language-tool-python==2.5.2
MarkupPy==1.14
mccabe==0.7.0
Naked==0.1.31
nltk==3.6.3
numpy==1.24.1
oauthlib==3.1.1
odfpy==1.4.1
openpyxl==3.0.10
Pillow==8.4.0
psycopg2==2.8.6
pybase64==1.2.0
pycodestyle==2.10.0
pycparser==2.20
pycryptodome==3.11.0
pyflakes==3.0.1
PyJWT==2.1.0
pyparsing==3.0.7
pytesseract==0.3.8
python3-openid==3.2.0
pytz==2021.1
PyYAML==6.0
rake-nltk==1.0.6
regex==2021.9.24
requests==2.27.1
requests-oauthlib==1.3.0
requests-toolbelt==0.9.1
rfc3986==1.4.0
scikit-learn==1.2.0
scipy==1.9.3
shellescape==3.8.1
six==1.16.0
sniffio==1.2.0
social-auth-app-django==4.0.0
social-auth-core==4.1.0
SpeechRecognition==3.8.1
sqlparse==0.4.1
tablib==3.3.0
threadpoolctl==3.0.0
tomli==2.0.1
tqdm==4.60.0
urllib3==1.25.11
whitenoise==5.2.0
xlrd==2.0.1
xlwt==1.3.0
我正在尝试为我提到的这个问题找到解决方案,但我没有在任何地方找到解决方案(有解决方案,但仅适用于 linux 操作系统),或者如果有,那么您可以共享链接吗?