musl版本standalone python在wsl默认的ubuntu中无法运行。说是找不到文件,其实文件就在那里
C:\d>wget https://mirror.nju.edu.cn/github-release/astral-sh/python-build-standalone/LatestRelease/cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz
2026-05-06 19:29:58 (40.0 MB/s) - 'cpython-3.14.5rc1+20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz' saved [28819140/28819140]
C:\d>wsl
root@DESKTOP-59T6U68:/mnt/c/d# mkdir tpy3145
root@DESKTOP-59T6U68:/mnt/c/d# cd tpy3145
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# tar xf ../cpython-3.14.5rc1+20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# cat /etc/issue
Ubuntu 22.04.5 LTS \n \l
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# time python/bin/python ../primes.py
-bash: python/bin/python: No such file or directory
real 0m0.018s
user 0m0.001s
sys 0m0.004s
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# ls -l python/bin/
total 21464
lrwxrwxrwx 1 root root 8 Jan 1 2024 idle3 -> idle3.14
-rwxrwxrwx 1 root root 156 Jan 1 2024 idle3.14
-rwxrwxrwx 1 root root 234 Jan 1 2024 pip
-rwxrwxrwx 1 root root 234 Jan 1 2024 pip3
-rwxrwxrwx 1 root root 234 Jan 1 2024 pip3.14
lrwxrwxrwx 1 root root 9 Jan 1 2024 pydoc3 -> pydoc3.14
-rwxrwxrwx 1 root root 141 Jan 1 2024 pydoc3.14
lrwxrwxrwx 1 root root 10 Jan 1 2024 python -> python3.14
lrwxrwxrwx 1 root root 10 Jan 1 2024 python3 -> python3.14
lrwxrwxrwx 1 root root 17 Jan 1 2024 python3-config -> python3.14-config
-rwxrwxrwx 1 root root 21971912 Jan 1 2024 python3.14
-rwxrwxrwx 1 root root 3198 Jan 1 2024 python3.14-config
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# rm -fr python
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145#
logout
改用gnu版本standalone python,一切正常。
C:\d>wget https://mirror.nju.edu.cn/github-release/astral-sh/python-build-standalone/LatestRelease/cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
2026-05-06 19:36:13 (19.9 MB/s) - 'cpython-3.14.5rc1+20260504-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz' saved [35924552/35924552]
C:\d>wsl
root@DESKTOP-59T6U68:/mnt/c/d# cd tpy3145
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# tar xf ../cpython-3.14.5rc1+20260504-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# time python/bin/python ../primes.py
real 0m1.982s
user 0m1.623s
sys 0m0.226s
在网上查询得知,Alpine版本Linux自带musl,刚好机器上有个alpine docker容器。
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# docker container list -a|grep Alpine
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# docker container list -a|grep pine
9d3934fdf92d m.daocloud.io/docker.io/alpine:latest /bin/sh 16 months ago Exited (0) 16 months ago alp2
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# docker start alp2
alp2
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# docker exec -it alp2 bash
Error: executable file `bash` not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
root@DESKTOP-59T6U68:/mnt/c/d/tpy3145# docker exec -it alp2 sh
/ # cd /par
sh: cd: can't cd to /par: No such file or directory
/ # wget https://mirror.nju.edu.cn/github-release/astral-sh/python-build-standalone/LatestRelease/cpython-3.14.5rc1%2B20
260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz
Connecting to mirror.nju.edu.cn (210.28.130.3:443)
saving to 'cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz'
cpython-3.14.5rc1%2B 100% |************************************************************************| 27.4M 0:00:00 ETA
'cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz' saved
/ # cd /tmp
/tmp # tar xf ../cpython-3.14.5rc1%2B20260504-x86_64-unknown-linux-musl-install_only_stripped.tar.gz
/tmp # vi
/tmp # cat /etc/issue
Welcome to Alpine Linux 3.21
Kernel \r on an \m (\l)
/tmp # time python/bin/python primes.py
real 0m 2.19s
user 0m 1.97s
sys 0m 0.22s
果然,musl版本standalone python可以在alpine中执行,速度的确比版本号相同的gnu python版本要慢一些。