在 Windows 上安装
psycopg2
时出现问题:UnicodeDecodeError 和元数据生成失败
我尝试使用 pip 在 Windows 计算机上安装 psycopg2 时遇到错误。这是我收到的错误输出:
Collecting psycopg2
Using cached psycopg2-2.9.10.tar.gz (385 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [78 lines of output]
...
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation byte
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
我已经尝试过的步骤:
我的
pg_config
输出:
pg_config
BINDIR = C:/PROGRA~1/POSTGR~1/16/bin
DOCDIR = C:/PROGRA~1/POSTGR~1/16/doc
HTMLDIR = C:/PROGRA~1/POSTGR~1/16/doc
INCLUDEDIR = C:/PROGRA~1/POSTGR~1/16/include
PKGINCLUDEDIR = C:/PROGRA~1/POSTGR~1/16/include
INCLUDEDIR-SERVER = C:/PROGRA~1/POSTGR~1/16/include/server
LIBDIR = C:/PROGRA~1/POSTGR~1/16/lib
PKGLIBDIR = C:/PROGRA~1/POSTGR~1/16/lib
LOCALEDIR = C:/PROGRA~1/POSTGR~1/16/share/locale
MANDIR = C:/Program Files/PostgreSQL/16/man
SHAREDIR = C:/PROGRA~1/POSTGR~1/16/share
SYSCONFDIR = C:/Program Files/PostgreSQL/16/etc
PGXS = C:/Program Files/PostgreSQL/16/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = --enable-thread-safety --enable-nls --with-ldap --with-ssl=openssl --with-uuid --with-libxml --with-libxslt --with-lz4 --with-zstd --with-icu --with-tcl --with-perl --with-python
CC = не записано
CPPFLAGS = не записано
CFLAGS = не записано
CFLAGS_SL = не записано
LDFLAGS = не записано
LDFLAGS_EX = не записано
LDFLAGS_SL = не записано
LIBS = не записано
VERSION = PostgreSQL 16.4
其他详细信息:
我需要帮助:
psycopg2 尚不兼容 Windows 上的 Python 3.13。截至目前,PyPi 上还没有可用的轮子。您可以为此包使用 Python 3.12。