為什麼別台電腦使用 python 3.11 打包的pypi 程式, 在我這台 win11 + python 3.14 透過 pip -m install 安裝時會出問題? 如何避免其他人安裝失敗?

◐ Now I have a good understanding of the codebase. Let me analyze the problem:

  1. The package is built with Python 3.10 (CI/CD in publish.yml uses python-version: '3.10')
  2. The requires-python = ">=3.10" in pyproject.toml is set correctly
  3. The user says “別台電腦使用 python 3.11 打包的pypi 程式” – but actually looking at the CI, it builds with Python 3.10, not 3.11 The real question is: why does a PyPI package built with Python 3.11 (or 3.10) fail when installed on Python 3.14? The main culprits are likely the wheel format and Python version compatibility. If the package is distributed as a version-specific wheel (like cp311), it won’t work on Python 3.14 unless there’s also a universal wheel or source
    distribution available. Even though requires-python = ">=3.10" should theoretically allow Python 3.14, the actual wheel files need to support that version. I should check what the user’s build output shows to see which wheel formats
    are being published. The package type determines compatibility—pure Python wheels tagged py3-none-any work across Python versions, while CPython-specific wheels only work on their exact version, and source distributions get built
    during installation. Since this project uses python -m build with pure Python code, it should generate a universal wheel, so version mismatches shouldn’t be the issue. The real concern is whether dependencies themselves support
    Python 3.14, which could cause installation failures even if the main package is compatible. Looking at the remaining issues, I need to set up a comprehensive testing strategy across Python versions 3.10 through 3.13, align the
    requirements.txt with what’s actually optional in pyproject.toml, and tighten the dependency constraints to prevent future breakage. I should also add Python version classifiers and create a CI workflow that catches compatibility
    issues early.

● 以下是所有修改:

增加 .github/workflows/ci.yml‎

– push / PR 時自動在 Python
3.10、3.11、3.12、3.13 × Ubuntu + Windows 共 8 種環境跑 smoke test
– 確保發布前已驗證多版本相容性

name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.10", "3.11", "3.12", "3.13"]
        os: [ubuntu-latest, windows-latest]

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install package
        run: pip install .

      - name: Smoke test — CLI help
        run: blogpro --help

      - name: Smoke test — versions command
        run: blogpro versions

根本原因補充:你這次安裝其實成功了,只是 PATH 問題。Python 3.14 是 pre-release,依賴套件(尤其是 ddgs)可能尚未支援,這才是真正的風險點。現在 ddgs 已改為 optional,不會再造成硬性安裝失敗。


修改內容

requirements.txt

 - openai>=1.0.0 → openai>=2.0.0
 - ddgs>=0.1 改為註解(optional,避免 Python
  3.14 上安裝失敗)

pyproject.toml

 - openai>=1.0.0 → openai>=2.0.0(避免安裝
  1.x 後執行時 API 錯誤)
 - 新增 classifiers,宣告支援 Python
  3.10 / 3.11 / 3.12 / 3.13(PyPI 頁面會顯示)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *