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

张开发
2026/4/12 17:05:20 15 分钟阅读

分享文章

用wsl自带的python 3.10下载适用于3.12的pandas版本结合uv安装python 3.12模拟离线安装场景
uv安装python 3.12root6ae32a5ffcde:/par/38# cd .. root6ae32a5ffcde:/par# mkdir 312 root6ae32a5ffcde:/par# cd 312 root6ae32a5ffcde:/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) root6ae32a5ffcde:/par/312# uv venv --python 3.12 Using CPython 3.12.13 Creating virtual environment at: .venv Activate with: source .venv/bin/activate root6ae32a5ffcde:/par/312# exit用wsl自带的python 3.10下载适用于3.12的pandas版本rootDESKTOP-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. rootDESKTOP-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-timeout100 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 numpy1.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-dateutil2.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 six1.5 (from python-dateutil2.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 rootDESKTOP-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返回安装了uv的docker环境rootDESKTOP-59T6U68:/mnt/c/d# docker exec -it gcc bash root6ae32a5ffcde:/# uv python list cpython-3.15.0a7-linux-x86_64-gnu download available cpython-3.15.0a7freethreaded-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.3freethreaded-linux-x86_64-gnu download available cpython-3.13.12-linux-x86_64-gnu download available cpython-3.13.12freethreaded-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 root6ae32a5ffcde:/# cd root/.local/share/uv/python/cpython-3.12-linux-x86_64-gnu/bin/ root6ae32a5ffcde:~/.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强制安装返回uv的venv python 3.12环境root6ae32a5ffcde:~/.local/share/uv/python/cpython-3.12-linux-x86_64-gnu/bin# cd root6ae32a5ffcde:~# cd par/312 bash: cd: par/312: No such file or directory root6ae32a5ffcde:~# cd /par/312 root6ae32a5ffcde:/par/312# ls root6ae32a5ffcde:/par/312# source .venv/bin/activate (312) root6ae32a5ffcde:/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-dateutil2.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) root6ae32a5ffcde:/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) root6ae32a5ffcde:/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) root6ae32a5ffcde:/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脚本安装pandasuv也能识别到import pandas也成功了。就是安装过程比uv安装慢。

更多文章