postgresql - psycopg2 所需的 Ubuntu 20.04 缺少的 postgres-plpython-12 在哪里?
问题描述
postgres-plpython-12 没有可用的软件包
https://packages.ubuntu.com/search?keywords=postgresql-plpython
psycopg2 库不能与 plpython3 一起使用(或者可以)?
psycopg2.errors.UndefinedFile: could not access file "$libdir/plpython2": No such file or directory
那么如何让 psycopg2 在 Ubuntu >= 20.04 上工作呢?
库libpq*
已安装。
libpq-dev is already the newest version (13.4-1.pgdg18.04+1).
libpq5 is already the newest version (13.4-1.pgdg18.04+1).
也许一切都必须在 postgres-13 上?libpq*
由于版本 12.x似乎没有明确的候选者
上面的错误是由 pytest-postgresql 从
postgresql = <connection object at 0x7fa79feaf548; dsn: 'user=postgres password=xxx dbname=app_test host=127.0.0.1 port=15988 options=''', closed: 0>
@pytest.fixture
def postgresql_config(postgresql) -> Dict:
# https://github.com/ClearcodeHQ/pytest-postgresql#how-to-use
# https://github.com/ClearcodeHQ/pytest-postgresql#configuration
# see pytest.ini for configuration options
# assert isinstance(postgresql, connection)
dsn = postgresql.get_dsn_parameters()
passwd_data = Path(dsn["passfile"]).read_text().strip()
passwd = passwd_data.split(":")[-1]
dsn_path = f"{dsn['user']}:{passwd}@{dsn['host']}:{dsn['port']}"
db_url = f"postgresql+psycopg2://{dsn_path}/{dsn['dbname']}"
admin_config = {
"timeout": 10,
"host": dsn["host"],
"port": dsn["port"],
"dbname": dsn["dbname"],
"username": dsn["user"],
"password": passwd,
"url": db_url,
}
# - init the test-db using the postgres admin user
# - for some tips on idempotent DDL, see:
# https://www.depesz.com/2008/06/18/conditional-ddl/
cursor = postgresql.cursor()
for statement in sqlparse.split(_setup_sql):
if statement:
> cursor.execute(statement)
E psycopg2.errors.UndefinedFile: could not access file "$libdir/plpython2": No such file or directory
解决方案
推荐阅读
- amazon-web-services - AWS 允许访问不同账户的 kinesis 流
- vulkan - 有什么更好的方法来解决没有太多信息的运行时 Vulkan 错误吗?
- associations - 我无法在 Gorm/Grails 3.3.9 中获得对实体集合的热切查询
- javascript - 如何使用过滤器检查对象是否在日期范围内?
- c - 尝试锁定共享内存互斥体时出现分段错误
- javascript - Android v3.3.0 variant.getMegrate() 已过时并替换为 variant.getMergeAssetsProvider()
- sql-server - 服务帐户已从 SQL Server 中删除,但 SQL 代理作业仍在已删除帐户的上下文中运行。如何?
- c# - Azure Functions 不会被 VS 发布的新内容覆盖?
- c++ - 为什么指针使用的内存比变量多?
- syntax - HL7 段中的括号和大括号是什么意思?