用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安装慢。

相关推荐
AI创界者4 小时前
Python 进阶实战(七十一章):研发效能度量、自动化质量门禁与工程规范落地实战
人工智能·python·aigc
yingjie1105 小时前
快榜GEO|官网 AI 可读性自查 12 项(附 Python 检测脚本)
开发语言·人工智能·python
tryCbest6 小时前
Python 爬虫扩展篇(二):验证码的检测与人工介入——把“拦路虎”当作信号,而不是要征服的对手
开发语言·爬虫·python
@陈小鱼8 小时前
基于InceptionTime网络的PPG无创血压估计算法研究
人工智能·python·算法·回归·开源·ppg·血压估计
谙弆悕博士8 小时前
动态自适应多智能体架构的 LangGraph 实现:从元调度器到可运行原型
人工智能·python·神经网络·机器学习·架构·多智能体·智能体
SeanQhl11 小时前
用 Python 给长文做排版体检:图够不够、段落是不是太长
python·自动化·markdown·代码规范·写作工具
SeanQhl12 小时前
中文 Windows 上跑 Python 定时任务——编码、路径、控制台三个坑
windows·python·编码·效率工具·定时任务
积流成海14 小时前
Agent演化史(十):2027年它会消失吗?(终章)
python·agent·智能体·大模型应用
专注仿真15 小时前
仿真智能体训练:强化学习中的奖励塑形算法与实战
python·强化学习·afsim智能体·仿真训练·afsim智能体训练
30955666616 小时前
股票接口日期参数为什么不起作用:五组请求对照与逐字节比对排查笔记
服务器·数据库·笔记·python·量化·api接口·股票接口