在 ubuntu-latest 中使用最新版本的 SQLite for Python

问题描述 投票:0回答:1

我创建了一个 GitHub Actions 工作流程。它应该运行 SQL 查询。它使用 JSON 的箭头运算符。这需要 SQLite >= 3.38.0。

这适用于具有

windows-latest
macos-latest
的系统,我可以说 Python 3.11 中安装的 SQLite >= 3.38。

但是我在

ubuntu-latest
中遇到了一个问题,它的值为 3.37。我想确保 Python 使用最新版本。

我确实尝试通过

sudo apt -y install sqlite3 libsqlite3-dev
安装,但它没有替换 Python 中的
sqlite3
版本,我收到了以下消息:

libsqlite3-dev is already the newest version (3.37.2-2ubuntu0.3).
sqlite3 is already the newest version (3.37.2-2ubuntu0.3).

参考github工作流程:

name: 'tests'

on:
  push:
    branches:
      - 'testing'

jobs:
    test:
      name: Test
      runs-on: ${{ matrix.os }}


      strategy:
        matrix:
          os: ['macos-latest', 'windows-latest', 'ubuntu-latest']

      steps:
        - uses: actions/checkout@v3

        - name: Install Latest sqlite3 version on non-windows platform
          if: ${{ matrix.os == 'ubuntu-latest' }}
          run: |
            bash ./.github/scripts/install-sqlite.sh

        - name: Set up Python 3.11
          uses: actions/setup-python@v3
          with:
            python-version: "3.11"

        - name: Install dependencies
          run: |
            python -m pip install --upgrade pip
            pip install poetry 
            poetry install

        - name: Smoke Test
          run: pytest __test__/test_smoke

我什至从源代码安装了它,当我尝试时版本改变了

sqlite --version
但它在Python中没有改变。

如何将

sqlite3
中的 Python 中的
ubuntu-latest
版本从 3.37 升级到 3.38?

python sqlite github-actions
1个回答
0
投票

此问题可通过 卸载现有 SQLite 之后 从源代码构建它来解决。

    构建sqlite源代码
  • 配置标题
  • 通过
  • apt-get remove -y --auto-remove sqlite3
    卸载现有版本
    
你会在 bash 脚本中找到它

# required to support: https://www.sqlite.org/json1.html#jptr # installing build: 3.45.0 wget https://www.sqlite.org/2024/sqlite-autoconf-3450000.tar.gz # unzipping build tar -xvzf sqlite-autoconf-3450000.tar.gz # below steps are for installing the build in /usr/local/bin cd sqlite-autoconf-3450000 || exit ./configure make sudo make install # remove the previous version sudo apt-get remove -y --auto-remove sqlite3
测试工作流程:

name: 'server-build' on: push: branches: - 'server-build' jobs: build: name: Building Executable needs: pre if: ${{ needs.pre.outputs.exists == 'false' }} runs-on: ${{ matrix.os }} outputs: skipped: ${{ needs.pre.outputs.exists }} # 'false' or 'true', false means executed strategy: matrix: os: ['macos-latest', 'windows-latest', 'ubuntu-latest'] steps: - uses: actions/checkout@v4 - name: If in ubuntu, Install sqlite3 3.45.0 if: ${{ matrix.os == 'ubuntu-latest' }} run: | bash ./build.sh - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: "3.11" - name: check run: | python -c "import sqlite3; print(sqlite3.sqlite_version_info);"
    
© www.soinside.com 2019 - 2024. All rights reserved.