用wsl自带的python 3.10下载适用于3.12的pandas版本结合uv安装python 3.12模拟离线安装场景

  1. uv安装python 3.12

    root@6ae32a5ffcde:/par/38# cd ..
    root@6ae32a5ffcde:/par# mkdir 312
    root@6ae32a5ffcde:/par# cd 312
    root@6ae32a5ffcde:/par/312# uv python install 3.12
    Installed Python 3.12.13 in 7.55s

    • cpython-3.12.13-linux-x86_64-gnu (python3.12)
      root@6ae32a5ffcde:/par/312# uv venv --python 3.12
      Using CPython 3.12.13
      Creating virtual environment at: .venv
      Activate with: source .venv/bin/activate
      root@6ae32a5ffcde:/par/312#
      exit
  2. 用wsl自带的python 3.10下载适用于3.12的pandas版本

    root@DESKTOP-59T6U68:/mnt/c/d# python3
    Python 3.10.12 (main, Mar 3 2026, 11:56:32) [GCC 11.4.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.

    root@DESKTOP-59T6U68:/mnt/c/d# python3 pip.pyz download pandas -d ./amdlxwhl/312 -i https://mirrors.aliyun.com/pypi/simple/ --platform manylinux_2_28_x86_64 --only-binary=:all: --python-version 3.12 --default-timeout=100
    Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
    Collecting pandas
    Downloading https://mirrors.aliyun.com/pypi/packages/c4/a8/3a61a721472959ab0ce865ef05d10b0d6bfe27ce8801c99f33d4fa996e65/pandas-3.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (10.9 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.9/10.9 MB 13.1 MB/s eta 0:00:00
    Collecting numpy>=1.26.0 (from pandas)
    Downloading https://mirrors.aliyun.com/pypi/packages/0a/0d/0e3ecece05b7a7e87ab9fb587855548da437a061326fff64a223b6dcb78a/numpy-2.4.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.6 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.6/16.6 MB 14.1 MB/s eta 0:00:00
    Collecting python-dateutil>=2.8.2 (from pandas)
    Downloading https://mirrors.aliyun.com/pypi/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
    Collecting six>=1.5 (from python-dateutil>=2.8.2->pandas)
    Downloading https://mirrors.aliyun.com/pypi/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl (11 kB)
    Saved ./amdlxwhl/312/pandas-3.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
    Saved ./amdlxwhl/312/numpy-2.4.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
    Saved ./amdlxwhl/312/python_dateutil-2.9.0.post0-py2.py3-none-any.whl
    Saved ./amdlxwhl/312/six-1.17.0-py2.py3-none-any.whl
    Successfully downloaded pandas numpy python-dateutil six
    root@DESKTOP-59T6U68:/mnt/c/d# ls amdlxwhl/312
    numpy-2.4.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
    pandas-3.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
    python_dateutil-2.9.0.post0-py2.py3-none-any.whl
    six-1.17.0-py2.py3-none-any.whl

  3. 返回安装了uv的docker环境

    root@DESKTOP-59T6U68:/mnt/c/d# docker exec -it gcc bash
    root@6ae32a5ffcde:/# uv python list
    cpython-3.15.0a7-linux-x86_64-gnu
    cpython-3.15.0a7+freethreaded-linux-x86_64-gnu
    cpython-3.14.3-linux-x86_64-gnu /root/.local/bin/python3.14 -> /root/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/bin/python3.14
    cpython-3.14.3-linux-x86_64-gnu /root/.local/share/uv/python/cpython-3.14-linux-x86_64-gnu/bin/python3.14
    cpython-3.14.3+freethreaded-linux-x86_64-gnu
    cpython-3.13.12-linux-x86_64-gnu
    cpython-3.13.12+freethreaded-linux-x86_64-gnu
    cpython-3.12.13-linux-x86_64-gnu /root/.local/bin/python3.12 -> /root/.local/share/uv/python/cpython-3.12-linux-x86_64-gnu/bin/python3.12
    cpython-3.12.13-linux-x86_64-gnu /root/.local/share/uv/python/cpython-3.12-linux-x86_64-gnu/bin/python3.12
    cpython-3.11.15-linux-x86_64-gnu
    cpython-3.11.2-linux-x86_64-gnu /usr/bin/python3.11
    cpython-3.11.2-linux-x86_64-gnu /usr/bin/python3 -> python3.11
    cpython-3.10.20-linux-x86_64-gnu
    cpython-3.9.25-linux-x86_64-gnu
    cpython-3.8.20-linux-x86_64-gnu /root/.local/share/uv/python/cpython-3.8-linux-x86_64-gnu/bin/python3.8
    pypy-3.11.15-linux-x86_64-gnu
    pypy-3.10.16-linux-x86_64-gnu
    pypy-3.9.19-linux-x86_64-gnu
    pypy-3.8.16-linux-x86_64-gnu
    graalpy-3.12.0-linux-x86_64-gnu
    graalpy-3.11.0-linux-x86_64-gnu
    graalpy-3.10.0-linux-x86_64-gnu
    graalpy-3.8.5-linux-x86_64-gnu
    root@6ae32a5ffcde:/# cd root/.local/share/uv/python/cpython-3.12-linux-x86_64-gnu/bin/
    root@6ae32a5ffcde:~/.local/share/uv/python/cpython-3.12-linux-x86_64-gnu/bin# ./python3.12 /par/pip.pyz install --no-index -f /par/amdlxwhl/312 pandas
    error: externally-managed-environment

    × This environment is externally managed
    ╰─> This Python installation is managed by uv and should not be modified.

    note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
    hint: See PEP 668 for the detailed specification.

试图在3.12的安装目录下直接安装离线包触发错误,不准备用--break-system-packages强制安装

  1. 返回uv的venv python 3.12环境

    root@6ae32a5ffcde:~/.local/share/uv/python/cpython-3.12-linux-x86_64-gnu/bin# cd
    root@6ae32a5ffcde:~# cd par/312
    bash: cd: par/312: No such file or directory
    root@6ae32a5ffcde:~# cd /par/312
    root@6ae32a5ffcde:/par/312# ls
    root@6ae32a5ffcde:/par/312# source .venv/bin/activate
    (312) root@6ae32a5ffcde:/par/312# python /par/pip.pyz install --no-index -f /par/amdlxwhl/312 pandas
    Looking in links: /par/amdlxwhl/312
    Processing /par/amdlxwhl/312/pandas-3.0.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
    Processing /par/amdlxwhl/312/numpy-2.4.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (from pandas)
    Processing /par/amdlxwhl/312/python_dateutil-2.9.0.post0-py2.py3-none-any.whl (from pandas)
    Processing /par/amdlxwhl/312/six-1.17.0-py2.py3-none-any.whl (from python-dateutil>=2.8.2->pandas)
    Installing collected packages: six, numpy, python-dateutil, pandas
    Successfully installed numpy-2.4.4 pandas-3.0.2 python-dateutil-2.9.0.post0 six-1.17.0
    (312) root@6ae32a5ffcde:/par/312# python /par/pip.pyz list installed
    Package Version


    numpy 2.4.4
    pandas 3.0.2
    python-dateutil 2.9.0.post0
    six 1.17.0
    (312) root@6ae32a5ffcde:/par/312# uv pip list
    Package Version


    numpy 2.4.4
    pandas 3.0.2
    python-dateutil 2.9.0.post0
    six 1.17.0
    (312) root@6ae32a5ffcde:/par/312# python
    Python 3.12.13 (main, Mar 24 2026, 22:49:22) [Clang 22.1.1 ] on linux
    Type "help", "copyright", "credits" or "license" for more information.

    import pandas

虽然用了自己的/par/pip.pyz脚本安装pandas,uv也能识别到,import pandas也成功了。就是安装过程比uv安装慢。

相关推荐
智能体与具身智能5 小时前
TVA具身智能的概念、架构与应用(19)
人工智能·python·具身智能
2601_962294616 小时前
python中range函数怎么用
python·for循环·可迭代对象·range函数·整数列表
2601_962295997 小时前
湖南码界领航教育科技有限公司:Python数据分析进阶,统计与可视化
numpy·pandas·统计·数据可视化·python数据分析
青 春 记 忆7 小时前
零基础入门python70:Docker Compose 编排完整后端
python·后端开发
新时代牛马7 小时前
字符设备驱动完整篇:从 cdev_add、file_operations 到chrdev_open 与排障
开发语言·python
白山编程大哥8 小时前
Java OutputStreamWriter 详解:从字符到字节的桥梁
java·开发语言·python
落羽的落羽8 小时前
【AI】快速理解AI应用的相关名词概念
linux·c++·人工智能·python·计算机网络·算法
Chasing__Dreams8 小时前
大模型应用开发--13--RAG 查询优化策略
python
“AI国潮设计-小江”9 小时前
《Python实战 | SDXL大模型批量生成“英歌舞海浪”蛋糕IP,附核心Prompt控制代码与IP授权变现思路》
人工智能·python·prompt·aigc
znnnk9 小时前
【Python】GUI 开发从入门到实战(三):PyQt/PySide 进阶之路
开发语言·python·pyqt