用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 <download available>
    cpython-3.15.0a7+freethreaded-linux-x86_64-gnu <download available>
    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 <download available>
    cpython-3.13.12-linux-x86_64-gnu <download available>
    cpython-3.13.12+freethreaded-linux-x86_64-gnu <download available>
    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 <download available>
    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 <download available>
    cpython-3.9.25-linux-x86_64-gnu <download available>
    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 <download available>
    pypy-3.10.16-linux-x86_64-gnu <download available>
    pypy-3.9.19-linux-x86_64-gnu <download available>
    pypy-3.8.16-linux-x86_64-gnu <download available>
    graalpy-3.12.0-linux-x86_64-gnu <download available>
    graalpy-3.11.0-linux-x86_64-gnu <download available>
    graalpy-3.10.0-linux-x86_64-gnu <download available>
    graalpy-3.8.5-linux-x86_64-gnu <download available>
    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安装慢。

相关推荐
飞Link2 小时前
【AI大模型实战】万字长文肝透大语言模型(LLM):从底层原理解析到企业级Python项目落地
开发语言·人工智能·python·语言模型·自然语言处理
翻斗包菜2 小时前
第 03 章 Python 操作 MySQL 数据库实战全解
数据库·python·mysql
xcjbqd03 小时前
如何修改Oracle服务器默认的日期格式_NLS_DATE_FORMAT全局配置
jvm·数据库·python
white-persist3 小时前
【vulhub spring CVE-2018-1270】CVE-2018-1270 Spring Messaging 远程命令执行漏洞 完整复现详细分析解释
java·服务器·网络·数据库·后端·python·spring
EnCi Zheng3 小时前
P2G-Python字符串方法完全指南-split、join、strip、replace的Python编程利器
开发语言·python
潇洒畅想3 小时前
1.1 从∑到∫:用循环理解求和与累积
java·数据结构·python·算法
有一个好名字3 小时前
Claude Code 50+命令全解析
python
liliangcsdn3 小时前
LLM如何与mcp server交互示例
linux·开发语言·python
Lupino3 小时前
拯救迷失的荧光溶解氧传感器:从“三无”到“复活”的全记录
python